External SWF to External SWF Timeline Communication, Flash, AS2

actionscript-2externalflashtimeline

Flash CS4, AS2

I have made an interactive tour. It can be seen here:

http://www.92YTribeca.org/Tour click on the bottom image

Each of the 4 sections are external swf and loaded on level 1. I want a button on one swf (floorplan) to load another swf (facility rentals) AND pinpoint a specific frame on the swf's timeline.

I have tried many different ways, all end up loading the swf at the first frame and ignore the rest of the code talking about the timeline. I know I could split this swf up into more external swfs and get the result I want, but I would rather use code if I can.

Is what I want to do possible? If so, how do I write the code?

Thanks!

Best Answer

What you want to do is definitely possible. You need to wait until the SWF is loaded before you can tell it to go to a specific frame. The easiest way to do this is using the MovieClipLoader class.

var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(this);

function onLoadComplete(loadedClip) {
    loadedClip.gotoAndStop(5);
}

loader.loadClip("floorplan.swf", targetClip);

That will load floorplan.swf into the placeholder named "targetClip" and, once it's loaded, have to jump to frame 5.

For more info, see the MovieClipLoader documentation: http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001993.html

Related Topic