A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Loading external SWF files

  1. #1
    Member
    Join Date
    Apr 2011
    Posts
    42

    Loading external SWF files

    I'm using this code to unload a swf file and go back to the main menu. The main menu has no trouble loading the external swf files but for some reason unloading just doesn't work :s

    function BackToMenu(i:MouseEvent):void
    {
    var BaseMovie:MovieClip = parent.parent as MovieClip; //Sets up a way of unloading this swf (back to main menu).
    BaseMovie.parent.removeChild(BaseMovie);
    }

    Edit: Code above now unloads loaded swf but just shows white.
    Last edited by AntBirch; 04-30-2012 at 06:28 AM.

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    unload() is only responsible for disconnecting a Loader object from an object it has loaded. If no other object contains a reference to that loaded object it will be garbage collected. In the case of swf files, it's likely still referenced by the display list in which case you will need to call displayObject.removeChild().

    unload() is mainly used for triggering an UNLOAD event that the loaded object may listen for and shut down any other data streams safely before being unloaded.

  3. #3
    Member
    Join Date
    Apr 2011
    Posts
    42
    hey have tried to do what you've said here but now as you can see by my edit of my original post I just get a white screen.

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