Load external MovieClip
This might be more complicated than I can handle at the moment but... right now I'm trying to find a way to load custom, animated artwork from and external .swf file. I would like to add a movie clip from the .swf file's library to my application. Happily, the class seems to load successfully: a function I created for it returns the proper value. Since the flex components don't like regular movie clips, I've added a UIMovieClip to the Application, and I add the contructed object to that. But nothing appears! I was puzzled, so I also tried to use the following. The property "container" is the UIMovieClip. When the box is drawn, both it and the external clip display marvelously. But nothing at all shows when the box is not drawn. Why? Is it because it has no dimensions?
container.visible = true;
with(container.graphics)
lineStyle(3,0x00ff00);
beginFill(0x0000FF);
drawRect(0,0,100,100);
endFill();
addElement(container);
Oh ya, and is there a way to find all of an ApplicationDomain's definitions or loop through them?
The child is a basic movie clip. It gets added when its class is loaded through events. Which has to occur after the application creation is complete, as this is when it is loaded. Is there a method I should use to make it reconsider the size or update the layout? I've already tried invalidating the application object...
Similar Messages
-
I want to load external swf in movieclip and next external swf should load Automatically
I want to load external swf in movieclip and next external swf should load Automatically when current swf is finished in AS3.
How can we can check total frame and current frame of imported swf in a movie clip.
any help will be appreciated
regards,
Jatin Demblain as3 you use the loader class (not movieclips) to load external swfs.
you can use an Event.COMPLETE event listener (applied to the loader's contentLoaderInfo property) to check when loading is complete and start the next swf loading.
you can use the loader's content property (caste as a movieclip) to determine info (including totalFrames) about the loaded swf's main timelnie (once loading is initialized, for the totalFrames, or complete, for some other properties like height and width).
var loader:Loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadcompleteF);
loader.load(new URLRequest("swf1.swf"));
var loadedSWF:MovieClip;
function loadcompleteF(e:Event):void{
loadedSWF=MovieClip(loader.content);
trace(loadedSWF.totalFrames); -
Referencing a movieclip instance from an (loaded) external swf.
Hi everybody
I'm new to AS3. Even experienced in AS2, i'm a bit confused
in getting the following result.
Let's assume the following.
The mainmovie has a movieclip instance called 'window1'. I
need to have loaded a movieclip (submov.swf) in the mainmovie. As a
final result a button is to be added to 'window1' after everytime
an instance of submov is created.
The document class of submov.swf is as follows
package
import flash.display.*;
import fl.controls.Button;
public class submov extends Sprite
function submov():void
var firstbutton:Button = new Button();
firstbutton.move(0,0);
firstbutton.setSize(70,30);
firstbutton.label = "Submit";
stage.window1.addChild(firstbutton); //this is the place
where error occurs (my assumption)
the first frame of the mainmovie express the following code
to load mainmov.
import flash.display.*;
import flash.net.URLRequest;
var ldr:Loader = new Loader();
var url:String = "mainmov.swf";
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq); // the first instance of mainmov created
here
var a:submov = new submov(); // the second instance of
mainmov created here
var b:submov = new submov(); // the third one created here
so the final result must be the button symbol created three
times in 'window1' (the position of the buttons may be ignored).
But what i'm getting is an error reporting
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at submov$iinit()
PLEASE HELP ME at this stage to overcome the problem.no,
i tried that too, but there is the following error reported.
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at submov$iinit() -
How to load a movieclip from libary with a button?
Hi!
I am kinda new to Flash and i have a queston.I made a
movieclip that i keep in the libary. I have a button that i want to
load the movieclip on the screen while pressing it. Queston is: how
or what kind of code do i put for the button to load the movieclip
wich is in my libary? As i see there is no simple soulution for
this with the script assistent? I got the option load movie but it
only loads external files or i get error messages when trying to
load my movie.
Please help me with this.
/Tobiasthere are a few things you'll need to do in order to achieve
this, but it's not to complicated. First right-click the MC in the
Library and select 'properties', then in the 'Linkage' section
select the check box 'Export for ActionScript' and the type a name
in the 'Identifier' field, hit OK. now you can access the MC by the
linkage ID.
the next thing you will need to know is 'where' you want to
place the MC, figure out the x,y position. then on the main
timeline, handle the 'button' code and we'll use 'attachMovie' to
bring the MC to the Stage. within the attachMovie method we'll also
pass the position you've decided upon. so it would look something
like this: -
developing a ui in flash for photo gallery which I am loading
into dreamweaver.
using as3 in flash to load external photo files so not all
having to download on opening.
have had no problem in dreamweaver with swfs with embedded
jpgs.
ui comes up in dreamweaver but not external files. even
though when I open swf movie or the flash created html of same
file, on its own, no prob.
anyone run across this problem, jpgs are in same file as
flash media, also dropped them into image file just in case that
might work---no go
any ideas ?your isse begins here ..
loadSection()
you use the same loader to not only load files but you are tyring to use it to target the movieClip you also want to play.
The issue is loader. The loader can only reference one load at a time.. otherwise you screw up your listeners and the ability to unload files properly.
You should load all files in Your current system as its own variable so that while one loads you can still control a movie.
So what type of end transitions do your files have?
What exactly with this seems like youre getting an issue.. looking at it looks alright aside from the fact that some methods are not used at all by your class -
Best Practice - load external image including rollovers
I am attempting to use the loader component to load an
external jpg, but experience issues having my flash app
successfully load a roll-over image from an external source when
the user rolls over the intital jpg. I am not a flash developer
(actually a .net developer trying to help a graphics guy out).
I started with the loader component, converted it to a movie
clip and then utilized the on(rollover) and on(rollout) events to
change the loader component's contentPath property at runtime via
ActionScript. I am not getting consistent results with this
strategy - what is the best way to accomplish this? Also note I
tried converted to a button, which seemed more logical, but the
loader component doesn't seem to like being converted to a button.
Regards,
DaflookieDaflookie,
> I started with the loader component, converted it to a
movie
> clip and then utilized the on(rollover) and on(rollout)
events
> to change the loader component's contentPath property at
> runtime via ActionScript. I am not getting consistent
results
Check out the Loader class in the Components Language
Reference. Loader
extends MovieClip, so there's no need to convert to a movie
clip symbol. In
addition, I recommend scrapping on() in favor of MovieClip
events, which
will probably be closer to your .NET point of view that the
older
on/onClipEvent approach to event handling (those are Flash
5-era).
Honestly, though, if you simply want to load images, I would
forego the
Loader component (no need for all that overhead) and use
MovieClipLoader to
load your images into the user's Internet cache. You'll see a
good handful
of events under that class listing as well (see the
ActionScript 2.0
Language Reference).
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
Unloading a loaded external SWF with a close button on the external SWF to unload
I have found some discussion on this topic but I am still having trouble getting it to work and was hoping to get some help here.
Here I have a file: http://www.dril-quip.com/test/main.swf
I have: main.swf (a menu) and I have module.swf (content)
If you navigate to Subsea Wellhead Systems/SS-15 BigBore II and click on that I have it load an external swf which covers most of the parent.
So far so good. My problem is unloading the loaded 'Child' swf with the button provided on the loaded 'Child' swf.
below is the code I used to load the file but I cant, for the life of me, find a way to unload it.
var bigboreLoader:Loader = new Loader();
btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
function bigborecontent(event:MouseEvent):void{
var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
bigboreLoader.load(bigboreRequest);
stage.addChild(bigboreLoader);
I am certain it requires the Child to communicate with the parent somehow but I am at a loss. If I could get a bit of advice or a link to something deal with this, it would be a big help. I just need to have my links load my modules and the remove them when the close buttong is hit on the loaded swf. I promise I have done searches and I admit I have found asnwers but still they are not working. I found the code below:
Main FLA:
function removeF() {
removeChild(bigboreLoader);
var bigboreLoader:Loader = new Loader();
btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
function bigborecontent(event:MouseEvent):void{
var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
bigboreLoader.load(bigboreRequest);
stage.addChild(bigboreLoader);
EXTERNAL FLA:
btnClose2.addEventListener(MouseEvent.CLICK, bigborecontent);
function bigborecontent(myevent:MouseEvent):void {
MovieClip(parent.parent).removeF();
I think I have a misunderstanding of the code. Thanks for any help you might be able to provide.This was the original code I got:
Main FLA: (on AS layer inside DropDownButton Movie Object)
function removeF() {
removeChild(myLoader);
var myLoader:Loader=new Loader ();
page1_mc.addEventListener(MouseEvent.CLICK, page1content);
function page1content(myevent:MouseEvent):void {
var myURL:URLRequest=new URLRequest("page1.swf");
myLoader.load(myURL);
addChild(myLoader);
EXTERNAL FLA: (on main time line of this file)
close_mc.addEventListener(MouseEvent.CLICK, closeMC);
function closeMC(myevent:MouseEvent):void {
MovieClip(parent.parent).removeF();
Main.FLA
myLoader=bigboreLoader (my new loader)
page1_mc=btnbb2 (the button who event will call external swf)
page1content = bigborecontent (name given to SWF being loaded???)
myURL=bigboreRequest (my new URLrequest for bigbore)
page1.swf=moduletemplate.swf (actual address of what I am loading)
External.FLA
close_mc=button that will close external swf
closeMC=movie clip to close? -
Loaded external swf vs CPU usage
Halo. I use the following code in order to load external "inde_2.swf" into "index.swf": (for Flash Player 9.0)
stop();
var myMovie:Sprite;
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop, false, 0, true);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done, false, 0, true);
l.load(new URLRequest("index.swf"));
function loop(e:ProgressEvent):void
var perc:Number = e.bytesLoaded / e.bytesTotal;
loader.percent.text = Math.ceil(perc*100).toString();
function done(e:Event):void
removeChildAt(0) // was removeChildAt(0) but it make more sense this way
loader.percent = null;
myMovie = Sprite(l.content);
addChild(myMovie);
var container:MovieClip = MovieClip(l.content);
addChild(container);
container.gotoAndStop(890);
l.contentLoaderInfo.removeEventListener( ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.removeEventListener(Event.COMPLETE, done);
l = null;
But unfortunately if "index.swf" is a complex file (with many objects etc.) , the loaded "index_2.swf" will play very slow (high CPU usage).
Is there any trick to unload "index.swf" so that "index_2" can play properly?if index_2.swf is a resource hog, there's nothing you can do in index.swf to fix that. on the other hand, you should clean up your index.swf code:
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop, false, 0, true);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done, false, 0, true);
l.load(new URLRequest("index.swf"));
function loop(e:ProgressEvent):void
var perc:Number = e.bytesLoaded / e.bytesTotal;
loader.percent.text = Math.ceil(perc*100).toString();
function done(e:Event):void
removeChildAt(0) // <-not sure this makes sense. what are you removing?
loader.percent = null;
var container:MovieClip = MovieClip(l.content);
addChild(container);
container.gotoAndStop(890);
l.contentLoaderInfo.removeEventListener( ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.removeEventListener(Event.COMPLETE, done);
l = null; -
Loaded external swfs with transitions
I need help getting my loaded swf files to play the "out" transition before the next movie loads. I have a main swf with 5 buttons (movie clips) that load external swf onto the stage.
package
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.events.*;
public class V2 extends MovieClip
private var sections_array:Array;
private var section_buttons_array:Array;
private var loader:Loader;
private var sectionHolder : MovieClip;
private var swf:String;
private var currentSection:int=0;
private var nextSection:int;
private var id:int=0;
private var homeLoc = "./swfs/home.swf";
public function V2()
init();
private function init():void
stop();
stage.frameRate=31;
preloader_mc.visible=false;
preloader_mc.fill_mc.width=0;
sectionHolder = new MovieClip();
sectionHolder.x = 37;
sectionHolder.y = 42;
addChild( sectionHolder );
sections_array = new Array('./swfs/section1.swf',
'./swfs/section2.swf',
'./swfs/section3.swf',
'./swfs/section4.swf',
'./swfs/section5.swf');
section_buttons_array = new Array(btn1,btn2,btn3,btn4,btn5);
addMenuListener();
addMenuEvents();
loadHome();
private function addMenuListener():void
for(var i:int=0;i < section_buttons_array.length;i++)
section_buttons_array[i].id=i;
section_buttons_array[i].addEventListener(MouseEvent.MOUSE_DOWN,loadSectionHand ler);
private function loadHome():void
swf=homeLoc;//sections_array[0];
var request:URLRequest=new URLRequest(swf);
loader=new Loader();
initListeners(loader.contentLoaderInfo);
loader.load(request);
id=0;
private function changeSection(m:MouseEvent):void
id=m.currentTarget.id+1;
loader.unload();
sectionHolder.removeChild(loader);
removeListeners(loader.contentLoaderInfo);
loadSection(m.target.parent.id+1);
private function loadSectionHandler(evt:MouseEvent)
id = evt.currentTarget.id;
loadSection(id);
private function loadSection(n:int):void
swf=sections_array[id];
var request:URLRequest=new URLRequest(swf);
initListeners(loader.contentLoaderInfo);
loader.load(request);
private function initListeners(dispatcher:IEventDispatcher):void
dispatcher.addEventListener(Event.OPEN,start);
dispatcher.addEventListener(ProgressEvent.PROGRESS,atLoading);
dispatcher.addEventListener(Event.COMPLETE,completed);
private function removeListeners(dispatcher:IEventDispatcher):void
dispatcher.removeEventListener(Event.OPEN,start);
dispatcher.removeEventListener(ProgressEvent.PROGRESS,atLoading);
dispatcher.removeEventListener(Event.COMPLETE,completed);
private function start(event:Event):void
preloader_mc.visible=true;
private function atLoading(event:ProgressEvent):void
var n:uint=(event.bytesLoaded/event.bytesTotal)*100;
preloader_mc.fill_mc.width=n;
private function completed(event:Event):void
sectionHolder.addChild(loader);
preloader_mc.visible=false;
private function stopAll():void
for(var i:int=0;i < section_buttons_array.length;i++)
section_buttons_array[i].stop();
sections_array[i].stop();
private function addMenuEvents():void
for(var i:int=0;i < section_buttons_array.length;i++)
section_buttons_array[i].mouseChildren=false;
section_buttons_array[i].buttonMode=true;
section_buttons_array[i].id=i;
section_buttons_array[i].isPressed=false;
section_buttons_array[i].addEventListener(MouseEvent.MOUSE_OVER,setOver);
section_buttons_array[i].addEventListener(MouseEvent.MOUSE_OUT,setOut);
section_buttons_array[i].addEventListener(MouseEvent.MOUSE_DOWN,setDown);
section_buttons_array[i].addEventListener(MouseEvent.MOUSE_UP,setUp);
private function setOver(evt:MouseEvent):void
if(evt.target.isPressed==false)
evt.target.gotoAndStop(2);
private function setOut(evt:MouseEvent):void
if(evt.target.isPressed==false)
evt.target.gotoAndStop(1);
private function setDown(evt:MouseEvent):void
nextSection=evt.target.id;
checkState(evt.target.id);
evt.target.gotoAndStop(3);
loadSection(1);
currentSection=evt.target.id;
private function setUp(evt:MouseEvent):void
if(evt.target.isPressed==false)
evt.target.gotoAndStop(1);
private function checkState(n:int):void
for(var i:int=0;i < section_buttons_array.length;i++)
if(i==n)
section_buttons_array[i].isPressed=true;
else
section_buttons_array[i].isPressed=false;
section_buttons_array[i].gotoAndStop(1);
private function removeSWF(e:Event):void
loader.unload();
removeEventListener("removeMe", removeSWF);
var request:URLRequest = new URLRequest(swf);
loader.load(request);
private function onClick(e:MouseEvent):void
targetID = e.currentTarget.id;
addEventListener("removeMe", removeSWF);
MovieClip(loader.content).play();
private function removeSWF(e:Event):void
loader.unload();
removeEventListener("removeMe", removeSWF);
The loaded swf has a stop() an intro animation and on the last frame have.
dispatchEvent(new Event("removeMe", true));your isse begins here ..
loadSection()
you use the same loader to not only load files but you are tyring to use it to target the movieClip you also want to play.
The issue is loader. The loader can only reference one load at a time.. otherwise you screw up your listeners and the ability to unload files properly.
You should load all files in Your current system as its own variable so that while one loads you can still control a movie.
So what type of end transitions do your files have?
What exactly with this seems like youre getting an issue.. looking at it looks alright aside from the fact that some methods are not used at all by your class -
Trouble with loading external mp3 files
I apologize for the length of the post. I hope this is clear
of what I am trying to explain.
My problem deals with getting "undefined" when I press a
button to load an external mp3 files. The following is what my XML
childNode looks like:
<option phonetic="Soundless, or A" name="aleph"
cursive="alephCursive.swf" block="alephBlock.swf"
audio="char1.mp3"/>
Every attribute loads the way I've programmed them, except
for the last one "audio".
The following is what my actionscript looks like loading in
these attributes:
Everything is happening inside the onLoad event for my XML
file.
var xmlContent = this.firstChild.firstChild;
audioContent = new Array();
for (var i = 0;
i<this.firstChild.firstChild.childNodes.length; i++) {
nextEntry = xmlContent.childNodes
audioContent = [nextEntry.attributes.phonetic,
nextEntry.attributes.name, nextEntry.attributes.cursive,
extEntry.attributes.block, nextEntry.attributes.audio];
The code above simply adds each attribute to the audioContent
array. Each element traces out correctly.
The following code is how I am using these attributes:
for (var i = 0; i<audioLength; i++) {
audioContainer.attachMovie("container4", "audioItem"+i, i);
// Create a shortcut reference to the present movie clip
thisClip = audioContainer["audioItem"+i];
thisClip.myTxt1.htmlText = audioContent[0];
thisClip.myTxt2.htmlText = audioContent
[1];
thisClip.cursive_mc =
loadThis(assetPath+audioContent[2], thisClip.cursive_mc);
thisClip.block_mc = loadThis(assetPath+audioContent
[3], thisClip.block_mc);
thisClip.speaker_mc.attachMovie("speaker", "speaker_mc",
this.getNextHighestDepth());
thisClip.speaker_mc.speaker_mc.onRollOver = function() {
this.nextFrame();
thisClip.speaker_mc.speaker_mc.onRollOut = function() {
this.prevFrame();
thisClip.speaker_mc.speaker_mc.onRelease = function() {
mySnd.loadSound(audioPath+audioContent[4],true);
Loading the text works inside the htmlText. Using a function
loadThis to load external swf files works corerctly and even
attaching a linked movieclip from my library called "speaker" works
correctly.
The problem comes from pressing the speaker movieclip that
the output traces "undefined" instead of the external mp3 file.
I appreciate any help. Thanks.As Ned said the problem might be with the file structure on the server. Other problems may be with spelling. You computer may not be case sensitive to the names of the .swf files that you are loading, but your server might. So, on your computer when you are testing, second.swf is the same as Second.swf, or even second.SWF. But, on the server each of these variations is seen as a different file. Another problem is that when you are loading files from the same computer in testing, those files are close and so they load very quickly from your computer. When the files have to travel from the server, there will likely be a measurable period of time before the file is ready to be shown. This is particularly problematic with video that is embedded into an .swf. The whole file will need to be downloaded and uncompressed before it is available to play. If you stream the video as an external file, you can shorten the wait considerably.
-
Loading External Images Causes Memory Leak
I have been working on an Actionscript 2.0 project that basically loads external images.
Everytime i load and unload a new image, memory increases to 1 or 2 MBs
If all the images are in cache, then it increased to 4 or 8 KBs
In the unloading of images, I have removed loader and the container of the image.
Any thoughts why it is behaving like that?
Please find the sample code snippet below.
btn_load.onRelease = function()
loadImage();
btn_unLoad.onRelease = function()
unLoadImage();
var mcListener:Object = new Object();
var container1:MovieClip;
var mcLoader:MovieClipLoader;
var loader_reference = this;
var n=0;
function loadImage(){
var image_arr = ["http://xyz.com/image1.png","http://xyz.com/image2.png","http://xyz.com/image3.png","http:/ /xyz.com/image4.png","http://xyz.com/image5.png"];
var image_url = image_arr[n];
if(n==image_arr.length-1) {
n=0;
}else{
n++;
container1 = loader_reference.createEmptyMovieClip("container1", loader_reference.getNextHighestDepth());
mcLoader = new MovieClipLoader();
mcLoader.removeListener(mcListener);
mcLoader.addListener(mcListener);
mcListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
mcListener.onLoadInit = function(target_mc:MovieClip):Void {
target_mc._x = 300;
target_mc._y = 200;
target_mc._width = 300;
target_mc._height = 250;
mcLoader.loadClip(image_url, container1);
function unLoadImage(){
mcLoader.unloadClip(container1);
mcLoader = null;
container1 = null;
removeMovieClip(loader_reference.container1);
Thanks in advance.that code should only execute once. fix that.
-
Im wanting to make a photo gallery that I can update easy, I
thought if I could have a movieclip load external images for my
thumbnails it would be nice but Im not sure how to set it up. I
would make a file for my images and then another for my thumbnails,
then if or when I want to switch out pictures I'd just have to drop
new images into my folders and not even touch the FLA. Could anyone
point me in the right direction with the right action script to use
or a tutorial that explains how this is done..
And when I say load external I want it so I dont have to
click on the image for it to load, I want it to just load
automatically , I would put an invisible button or something to
that efect over the images for a animated effect.
Thanks for your help.I don't know if you are super enthusiastic about building it,
or if you just want the utility. If the later is the case, I just
purchased (cheap) a really great product that does all of what you
want, fairly automatically, including scaling large pictures down
to smaller size so that they load quickly.
I am not sure of the policy of recommending third-party
applicatons here. So, if you are interested, send an email (private
message) to me and I will show you the simple site I put together
using it and where to get it. -
Var doesn't work if I load external swf.
I have a set up with two pages or labeled sections on the main timeline. I brake the code corresponding to actions happening in each page/labeled section. On first page there is a var specified for each button
var sourceVar:String;
Then each button uses this var to load a video into FLV player (player itself is constructed in the second page/labeled section).
function JTV_SatelliteCenterpiece_PlayVideoPopUp(event:MouseEvent): void {
sourceVar="howto_popups/jtvs18w12_LG30.flv";
gotoAndPlay("flv_pb");
where "flv_pb" is the label for the second page/labeled section. On this second page/labeled section there is an FLVPlayback component named "SWF_flv2" which uses this var
SWF_flv2.source = sourceVar;
All above works. My problem is that I decided to load externally all the items (image buttons) into the first section. So I saved them as an external SWF file, with all the code in that external swf file.
Then I link the buttons to section "flv_pb" this way:
function JTV_SatelliteCenterpiece_PlayVideoPopUp(event:MouseEvent): void {
MovieClip(parent.parent.parent).sourceVar="howto_popups/jtvs18w07_LG30.flv";
MovieClip(parent.parent.parent).gotoAndPlay("flv_pb");
The link to the "flv_pb" section works, which tells me that the set up with "MovieClip(parent.parent.parent)." is appropriate.
However the code as before with the set up of (still being in the external swf file):
sourceVar="howto_popups/jtvs18w12_LG30.flv";
gotoAndPlay("flv_pb");
works as well, I am not sure why?
The problem seems to be in the var
I have an error message 1120: Access of undefined property sourceVar
It is referencing the code in the second page/labeled section "flv_pb"
SWF_flv2.source = sourceVar;
What are my actions? I kept the code in the external swf file. Should I move it to the main timeline if it is possible? Should I only reference the var in the main time line?
Should all the code be kept in the beginning of the time line, rather be sectioned into the sections?Thank you for your reply.
Please let me know if all the animation code should be left in the external SWF file (which is being loaded) and all the linkage code on the main time line?
If so then the code block specifying the link and loading on the botton:
var sourceVar:String;
//JTV_SatelliteCenterpiece_btn////////////////////////////////////////////////////
//event listener//
howTo_mainInfo.JTVs.JTV_SatelliteCenterpiece_btn.addEventListener(MouseEvent.CLICK, JTV_SatelliteCenterpiece_PlayVideoPopUp);
function JTV_SatelliteCenterpiece_PlayVideoPopUp(event:MouseEvent): void {
//MovieClip(parent.parent.parent).sourceVar="howto_popups/jtvs18w07_LG30.flv";
sourceVar="howto_popups/jtvs18w07_LG30.flv";
gotoAndPlay("flv_pb");
Should be left as it is on the main time line or only the function part and event listener put in the external SWF file?
I tried this way puttin the var and function on the main time line and it brings me to the proper page/labeled section but doesn't load the video.
In the OUTPUT Panel I have an error message:
VideoError: 1000: Unable to make connection to server or to find FLV on server
at fl.video::VideoPlayer/stop()
at fl.video::FLVPlayback/stop()
at acolyte46_howTo_Loader_fla::mainsite_mc_2/stopF2()[acolyte46_howTo_Loader_fla.mainsite_mc _2::frame283:49]
at flash.display::MovieClip/gotoAndPlay()
at acolyte46_howTo_Loader_fla::mainsite_mc_2/onClick_closeXhowToVideos_btn()[acolyte46_howTo _Loader_fla.mainsite_mc_2::frame283:28]
Frame 283 is "flv_pb" page/labeled section to where the links properly works but video is not being loaded?
Same code perfectly worked without any error message before I moved things into an external SWF file.
I am also confused why both ways are working out of the loaded SWF file:
MovieClip(parent.parent.parent).sourceVar="howto_popups/jtvs18w07_LG30.flv";
and
sourceVar="howto_popups/jtvs18w07_LG30.flv";
shouldn't only one be the correct one? -
Loading from library conflicts with loading external swf
I'm very new to ActionScript, so this might be incredibly basic. However, I've Googled and read myself into a coma and I'm not finding a solution.
I have a movie with 6 navigation buttons. Four of them load external .swf slideshows, and they work fine - as each file loads, the previous one clears the stage, etc. The other button that I currently have set up is loading, from the library, an image. The problem I'm having is that the slideshows replace each other on the stage - they're not stacking, they're replacing - but when the user selects the button that loads the image, the image overlays the last-selected slideshow. If the user selects the image first, the image is visible when two of the external files transition. Because of that 6th button, which is not yet even started, it's not desirable to me to simply set up the single image as another external file; if it's at all possible, I need to be able to pull from a library file when I build that last button.
What I'd like to do - because there is no logical order that the buttons should be selected in - is figure out how to tell every button to remove the image file on click. I've tried using this in the four buttons that link to the slideshows, to deal with the image (that's the one called quoteImage):
if(myLoader != null && contains(quoteImage)){
myLoader.removeChild(quoteImage);
which has the advantage of not giving me any errors, but doesn't actually fix my problem. I've tried many, many other things, and I'm just really stumped on what exactly I need to do to make this work the way I want it to. Based on the fact that the books and online resources I've been using don't really cover this specific example, I suspect it might be an incredibly idiot thing to do, but I'd really like it to work this way if that's possible.
The code as it stands, with the global variables and the first two buttons (the next three are identical to the second button and the sixth button doesn't exist) looks like this:
var myLoader:Loader=new Loader();
var quoteImage:Bitmap;
stop();
// Loads quoteImage from library
btnQuotes.addEventListener(MouseEvent.CLICK, showquote);
function showquote(event:MouseEvent):void {
var myBitmapDataObject:myBitmapData = new myBitmapData(500, 350);
var quoteImage:Bitmap = new Bitmap(myBitmapDataObject);
quoteImage.x=150;
quoteImage.y=180;
addChild(quoteImage);
// Loads industrial.swf from external file
btnIndustrial.addEventListener(MouseEvent.CLICK, showindustrialcontent);
function showindustrialcontent(event:MouseEvent):void {
var myURL:URLRequest=new URLRequest("industrial.swf");
myLoader.x=150;
myLoader.y=180;
myLoader.load(myURL);
addChild(myLoader);
Help is very much appreciated.I see now how to import and display a library class object
using:
var MovieClipClass:Class =
Class(loader.contentLoaderInfo.applicationDomain.getDefinition("myLibraryAsset"))
var movieClip:Sprite = new MovieClipClass();
addChild(movieClip)
But this seems to only work for SWF's published for AS3 Flash
Player 9.
I need to do the same for SWF's published with AS2 Flash
Player 7.
Any ideas? -
I cannot load external jpg, they're not progresive.... the
jpg files are inside a folder, and I write the next code:
this.createEmptyMovieClip("mc", 100);
mc.loadMovie("flash/photo1.jpg");
but it doesn't work...
Thanksuse trace(mc) to confirm "this" refers to a movieclip, make
sure there's nothing at a greater depth preventing you from seeing
your image, double check your spelling of flash/photo1.jpg (and
case counts) and make sure your html file is in a super folder of
the flash folder, if you're testing in a browser.
Maybe you are looking for
-
Ship-to and Sold-to countries characteristics
Dear CO-PA gurus I'd like to manage "Ship-to country" and "Sold-to country" as characteristics. I created 2 of "WWxxx" as new characteristics and defined derivation with "table lookup". For those characteristics, I defined field lengths are 2, since
-
Vendor field on SRM Purchase Order
Hi. Please can someone elaborate and explain why my preferred supplier that I have entered onto my Cart does not copy through to the Vendor field on SRM Purchase Order please? At this moment, the Preferred Vendor field is incorrectly populated wherea
-
When can we get a Lightroom 4 Lens Corrections Profile for the new AF-S Nikon 80-400mm f/4.5-5.6 G ED VR lens?
-
Mac Spotlight Results: Right Click/Open With/Reveal in Finder?
Hi, As many others, I am a heavy Spotlight user/searcher. I tried quite a bit around, but I seem not to be able to "right click" open with on the Spotlight search results (Spotlight used from the menubar). I can open search results, but that is most
-
Aperture doubles my space used...what to do?
Hi, I am using Aperture Version 3.6 on OS X Yosemite 10.10. I just realised that my 28'000 Photos use a disk space of 680 GB. I found out that i have: 300 GB of Masters 260 GB of Preview 110 GB of iPod Photo Cache and 15 GB of Thumbnails! I did some