close an external swf which is part of an array
Hi.
Noob and having to learn all this pretty quick.. So thanks for any help you can give me.
Here's the basics - Flash cs4 and as3.
I'm making an app which is, at the moment, a game.
I have an animation on the maintimeline - this (at the momoent - until I make it functional) animates through the menu selection to the games menu.. All fine.
I then have placed an empty MC on the stage which will contain all the games. So I click the first game - Flash then selects from 5 possible versions (3 in the code at the mo) and it plays on top of the menu - with a master menu at the bottom of the page.
The game loads fine, the random loading works fine - I just can't get rid of the imported SWF. I've tried a multitude of ways and codes from the internet - had to give up in the end yesterday and so am starting with fresh hope today ![]()
I think, the ideal scenario, for me, is to have each SWF that imports - to switch itself off at the end of the game - last frame and disappear. I know it is possible - I'm pretty sure, back in the day in AS2, it was as simple as close.this (or something like that)
thanks
stop();
bee.addEventListener(MouseEvent.CLICK, Click);
function Click( event:MouseEvent):void {
gotoAndPlay(currentFrame+1);
}
bee.addEventListener(MouseEvent.CLICK,f);
function f(e:Event):void{
var movieArray:Array = ["howmanybees1", "howmanybees2", "howmanybees3",];
var loader:Loader = new Loader();
var index:int = movieArray.length * Math.random();
var url:String = movieArray[index] + '.swf';
trace("Attempting to load", url);
loader.load(new URLRequest(url)); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOError);
addChild(loader);
function loaderComplete(e:Event):void {
trace("Successfully loaded", url);
} function loaderIOError(e:IOErrorEvent):void {
trace("Failed to load", url);
}
}
