A Flash Developer Resource Site

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Jun 2012

    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);


    function finishLoading(loadEvent:Event) {

    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;


    btn_sol.addEventListener(MouseEvent.MOUSE_DOWN, sol01);

    function sol01(e:MouseEvent){



    and also fscommand("quit");

    but it didnt work...

    any ideas?

  2. #2
    Senior Member
    Join Date
    Nov 2012
    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){

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.