-
1. Re: Loading two swfs and playing them sequentially
Ned Murphy May 5, 2013 5:26 AM (in response to dewwondm)One way would be to use the same Loader for both swf's, making the first one's completion trigger the loading of the second.
Another would be to use two different Loaders and have the second one remain invisible until it is called upon to display its content.
In any case, you need to have some way of determining when the first swf is finished playing. You could have the first dispatch an event and have the main file assign a listener for this event when the first is first loaded. THat way, when the event is dispatched, the main file can do whatever it needs to do to remove the first and display the second.
-
2. Re: Loading two swfs and playing them sequentially
dewwondm May 9, 2013 10:59 AM (in response to Ned Murphy)Hi Ned, thank you so much for replying. Not to trouble sir, but is there anyway you could write an example script so that I can get a visual of what the proper script should look like? Thanks.
-
3. Re: Loading two swfs and playing them sequentially
Ned Murphy May 10, 2013 3:39 AM (in response to dewwondm)AS3 - Dispatch Event
--------------------Example:
Add something to trigger the event in the child:
dispatchEvent(new Event("eventTriggered"));(if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
The listener for this event has to be added to the main file AFTER the external file has been loaded. In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo.yourLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler);
In the complete event handler, add a listener for the event on the loaded swf.
// event handler triggered when external swf is loaded
function loaderCompleteHandler(event:Event) {
MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
}Then just create the event handler for the dispatched event listener that was created in the loaderCompleteHandler function.
function eventHandler(event:Event):void {
trace("event dispatched in loaded swf");// load/play your second swf now
} -
4. Re: Loading two swfs and playing them sequentially
dewwondm May 10, 2013 5:35 AM (in response to Ned Murphy)Ned, good sir, I can't tell how thankful I am for your assistance. This is exactly what I have been looking for, and trying to do for the longest. YOU ARE THE MAN!!!!


