-
[RESOLVED] Calling External Swf And Loading On A Frame Label
I have a button on my main timeline that calls an external swf file into an empty container movie. How do I load external swf file and play on a particular frame label?
I want to load a file called original.swf and start playing on a frame label called wheels.
any ideas?
Thanks!
-
Senior Member
You need to load the movie and then add an Eventlistener with a COMPLETE event. Within the listener function you then use
event.currentTarget.content.gotoAndPlay("wheels");
Check the language reference for the Loader class. There are examples.
- The right of the People to create Flash movies shall not be infringed. -
-
Thank you for your answer,
i made this:
Code:
stop();
var my_loader:Loader = new Loader();
addChild(my_loader);
button.addEventListener(MouseEvent.CLICK, clickmouse);
function clickmouse(evt:MouseEvent):void {
my_loader.load(new URLRequest("a.swf"));
}
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, startListener);
function startListener (e:Event):void{
trace("Loading complete");
e.currentTarget.gotoAndPlay("B");
}
And the output windows show this:
Loading complete
ReferenceError: Error #1069: Property gotoAndPlay not found on flash.display.LoaderInfo and there is no default value.
at test1_fla::MainTimeline/startListener()
What am i doing wrong?
-
Senior Member
e.currentTarget.content.gotoAndPlay("B");
- The right of the People to create Flash movies shall not be infringed. -
-
Thanks for your help is not working yet, the output windows show this:
Loading complete
ArgumentError: Error #2109: Frame label B not found in scene Scene 1.
at flash.display::MovieClip/gotoAndPlay()
at test1_fla::MainTimeline/startListener()
-
Senior Member
It means you don't have a frame label "B" in your movie. Check your movie for that.
- The right of the People to create Flash movies shall not be infringed. -
-
thank you for response, by the way i found a solution, an this is it:
Code:
var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("external.swf");
ldr.load(urlReq);
function loadHandler (e:Event) {
var myClip:MovieClip = e.target.content;
addChild(myClip);
///////////////////////////////////////////////////////////////
function clickSub(e:MouseEvent):void {
myClip.nosotrosmc.gotoAndStop(e.target.name);
//myClip.islasmc.gotoAndStop(e.target.name);
}
// set listeners subButtons
button.addEventListener(MouseEvent.MOUSE_UP, clickSub);
}
// listener
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loadHandler);
Hope this serves like reference......
thank you for your help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|