Copy link to clipboard
Copied
I have two swf files that I would like to play in sequence in a main flash file. The two swf files are partA.swf and partB.swf. I set up two frames using this actionscript 3 snippet:
Frame 1:
var partARequest:URLRequest = new URLRequest("partA.swf");
var partALoader:Loader = new Loader();
partALoader.load(partARequest);
addChild(partALoader);var partBRequest:URLRequest = new URLRequest("partB.swf");
var partBLoader:Loader = new Loader();
partBLoader.load(partBRequest);
addChild(partBLoader);Copy link to clipboard
Copied
Here's a nice trick that Andrei1 taught me a week ago or so that should sort out your problem:
On the last frame of partA.swf, you could dispatch an event, like so:
dispatchEvent(new Event("advanceParentTimeline"));Then, in your parent movie on the frame that partA gets loaded, you can listen for the text, like so:
stage.addEventListener("advanceParentTimeline", onTextRequest, true);Add the following function to the same frame with the listener mentioned above, and if your parent movie hears that text, send your movie to frame 2, like so:
function onTextRequest(e:Event):void {
gotoAndStop(2);
}Hope that helps,
~Chipleh
Copy link to clipboard
Copied
Errors are not compiling, but the movies aren't appearing right. It's just rapidly blinking. What could be causing this?
Thanks for your reply
Chris
Copy link to clipboard
Copied
Most likely a script error, which tends to make movies "flash rapidly"
Post the code you're using in your parent and child movies so we can take a look.
Copy link to clipboard
Copied
Sure thing:
Parent:
Frame 1 calling PartA.swf:
var partARequest:URLRequest = new URLRequest("partA.swf");
var partALoader:Loader = new Loader();
partALoader.load(partARequest);
addChild(partALoader);
function onTextRequest(e:Event):void {
gotoAndStop(2);
}
stage.addEventListener("advanceParentTimeline", onTextRequest, true);
Frame 2 calling PartB.swf:
var partBRequest:URLRequest = new URLRequest("partB.swf");
var partBLoader:Loader = new Loader();
partBLoader.load(partBRequest);
addChild(partBLoader);
-----------------------------------------------------------------------------------------------------------------------
PartA.swf
dispatchEvent(new Event("advanceParentTimeline"));
PartB.swf
-- no actionscript --
Thank you
Chris
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more