I'm creating an interactive game. I now have 6 swf files that I need to load and I need to play them sequentially.
I have a lots of question regarding this topic and here are they :)
1st Question: How can I load a external swf file after a cinematic scene?
In my 3rd swf files I have like a cinematic scene and it will be finished approximately 30 seconds. I know the delay method, but is it functioning smoothly when I already uploaded it to my website?
2nd Question: How to load all external files before user start playing the game?
How can I load all my swf files at once before letting the user play the game?
Here's some part sample of my code:
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
var myClip:MovieClip = root as MovieClip;
var externalClip:MovieClip;
var myLoader:Loader = new Loader();
var myLoader1:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompletedHandler);
function loaderCompletedHandler(evt:Event):void {
externalClip = myLoader.content as MovieClip;
externalClip.ext_btn.addEventListener(MouseEvent.CLICK,extCommunicate);
function extCommunicate(evt:MouseEvent):void {
trace("TEST");
myLoader1.contentLoaderInfo.addEventListener(Event.COMPLETE, thirdloaderCompletedHandler);
var newstring:String = "third.swf";
var newREQ:URLRequest = new URLRequest(newstring);
addChild(myLoader1);
myLoader1.load(newREQ);
myLoader1.x=40;
myLoader1.y=20;
removeChild(myLoader);
}
}
function thirdloaderCompletedHandler(evt:Event):void {
trace("YEAH");
}
var externalString:String = "external.swf";
var urlREQ:URLRequest = new URLRequest(externalString);
playbtn.addEventListener(MouseEvent.CLICK,swfLoad);
function swfLoad(evt:MouseEvent):void {
addChild(myLoader);
myLoader.load(urlREQ);
myLoader.x=40;
myLoader.y=20;
}
3rd Question: Is the above code is the proper way of loading multiple swf files?