I have a.swf (2 frame) and b.swf(10 frame as animation).
On A’s 1.frame, A loads B and B plays.
I want, when **B finished (on B’s last frame), B makes that A will goto 2.frame
Like: **MovieClip(root).gotoAndStop(3);
I have a.swf (2 frame) and b.swf(10 frame as animation).
On A’s 1.frame, A loads B and B plays.
I want, when **B finished (on B’s last frame), B makes that A will goto 2.frame
Like: **MovieClip(root).gotoAndStop(3);
dispatch an event on frame ten in b.swf and listen to it in a.swf
//frame 10, b.swf
dispatchEvent(new Event("COMPLETE"));
//frame 1, a.swf
b.addEventListener("COMPLETE", onComplete);
function onComplete( e:Event ):void
{
gotoAndStop(2);
}
just make sure you set the listener after b.swf has completely loaded into a.swf.
I did you said
but didnt worked
var ldr:Loader = new Loader();
var url:String = "http://127.0.0.1/test.swf";
var urlReq:URLRequest = new URLRequest(url);
trace("first");
ldr.load(urlReq);
box.addChild(ldr);
ldr.addEventListener("COMPLETE", onComplete);
function onComplete( e:Event ):void{
trace("ok");
}
hey, sorry should’ve been more clear…
you need to set the listener to the loaded content when it’s loaded - not on the loader.
so, first you need to listen to the loader to know when the swf has been loaded.
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
when the swf has loaded you can add the listener to it.
function onLoadComplete(e:Event):void
{
e.target.content.addEventListener("COMPLETE", onComplete);
}
Worked Successfully, viele danke!!
:: Copyright KIRUPA 2024 //--