-
Problems with AS3
Hi, I have a question,
I'm using AS3 to load an swf inside a swf using this code.
var my_Loader:Loader = new Loader();
var my_url:URLRequest=new URLRequest("example.swf");
my_Loader.contentLoaderInfo.addEventListener(Event .COMPLETE, finishLoading);
my_Loader.contentLoaderInfo.addEventListener(IOErr orEvent.IO_ERROR, errorHandler);
my_Loader.load(my_url);
function finishLoading(loadEvent:Event) {
addChild(loadEvent.currentTarget.content);
}
function errorHandler(errorEvent:Event):void {
trace("file missing");
}
Now everything work great but what I want is once the "example.swf" is loaded the user can click a button inside the "example.swf" and this swf close so I can navigate in the first swf.
I tried adding
import flash.display.StageScaleMode;
stage.scaleMode = StageScaleMode.NO_SCALE;
stop();
btn_sol.addEventListener(MouseEvent.MOUSE_DOWN, sol01);
function sol01(e:MouseEvent){
ExternalInterface.call("closeBrowserWindow");
}
and also fscommand("quit");
but it didnt work...
any ideas?
-
If I understand your application, and how you are adding the example swf... then you would not want to use external interface and close the browser window. You would just want to remove the Loader from the display list inside of flash.
You would do this by calling removeChild(my_Loader);
if you are writing the code from inside the example.swf you would need something like this
function that tells your button to close{
if(parent is Loader){
MovieClip(this.parent.parent).removeChild(this);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|