Load External SWF using AS3
Ok I'm very, very new to this but this is what I wanted to happen
I made a series of individual animations that I now have to flow together. Since the animations are different flash files, I figured maybe I'll create a new Flash file and just load in all the individual swfs to just play continuously. NO mouse click needed. I just need it to play when opened and thats it.
So would a load movie be the way to go? If so I found this code
var request:URLRequest = new URLRequest("http://www.[yourdomain].com/externalSwf.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);
AND
do external swfs have to be hosted on the web? can i just type out a path? If I can just include a patch what's the syntax for this?
Thanks!!!!
Load External SWF using AS3
I've been able to externally Load the swf (yay!)'
BUT
I can only do it for 1 swf, I need to have 11 swfs autoplay.
how can I do this? The current swf needs to be removed and load in a new one. While the other swfs are being loaded it needs to be stopped so when it loads it starts from the top! I would also need a slight alpha transition when a new swf starts.
I know, I know a lot of requests.... help?
This is the code I ended up with to load 1 external swf:
var img1Request:URLRequest=new URLRequest("swfs/ADVAllDemoFLASHv1.0.swf");
var img1Loader:Loader = new Loader();
img1Loader.load(img1Request);
_1.addChild(img1Loader);
so how will this work for 11 others?
thanks!
Load External SWF using AS3
ah, I get what you're saying.
So... I keep getting this error?
ReferenceError: Error #1069: Property Loader not found on flash.display.LoaderInfo and there is no default value.
at test1_fla::MainTimeline/loadComplete()
also, Only the 3rd swf plays, it's always the last swf that plays.
--------
THIS WAS THE CODE:
import flash.display.*;
import flash.net.URLRequest;
var externalSWFs:Array = new Array(
"swfs/ADVRulesMgrFLASHv1.0.swf", "swfs/ADVGenevaFLASHV2.2.swf", "swfs/ADVIndAdvisorFLASHv1.0.swf");
var loadedSWFs:Array = new Array();
for (var i:int=0; i<externalSWFs.length; i++) {
// create a loader
var imgLoader:Loader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, loadComplete);
// load the SWF
var imgRequest:URLRequest=new URLRequest(externalSWFs[i]);
imgLoader.load(imgRequest);
// keep track of the SWF for later
loadedSWFs.push(imgLoader);
_1.addChild(imgLoader);
}
var loaded:int=0;
var currentAnimation:int=0;
function loadComplete(event:Event):void {
// pause and hide the SWF
event.target.Loader.stop();
event.target.Loader.visible=false;
if (++loaded==externalSWFs.length) {
// all SWFs loaded
// start the first animation
loadedSWFs[currentAnimation].visible=true;
loadedSWFs[currentAnimation].play();
currentAnimation++;
}
}
Thank you so much for helping me!!!