Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

+ Reply to Thread
Results 1 to 2 of 2
  1. #1

    Default load unload movie as3

    I have spent the last two days searching the web for an answer and had little joy so can you help me?

    I found this bit here: htt ://kb2.adobe.com/cps/141/tn_14190.html

    Code:
    var myLoader:Loader = new Loader();                     // create a new instance of the Loader class
    var url:URLRequest = new URLRequest("news.swf");        // in this case both SWFs are in the same folder 
    myLoader.load(url);                                     // load the SWF file
    addChild(myLoader);                                     // add that instance to the display list, adding it to the Stage at 0,0
    
    // location
    myLoader.x = 590;                                        // move the loaded SWF 10 pixels to the right (from the left edge)   
    myLoader.y = 53;                                       // move the loaded SWF 175 pixels down from the top
    
    btn_home.addEventListener(MouseEvent.CLICK, GoToAndStop2);
    It works fine but as you can guess as soon as I navigate away with my 'btn_home' the swf is still there over the top of everything else, can anyone help me with the unloadmovie script for when I press the btn_home?

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2

    Default

    Figured out the answer for anyone that needs it as well.

    unloadAndStop() is what I used and here is how I used it.

    Code:
    var myLoader:Loader = new Loader();                     // create a new instance of the Loader class
    var url:URLRequest = new URLRequest("news.swf");        // in this case both SWFs are in the same folder 
    myLoader.load(url);                                       // load the SWF file
    addChild(myLoader);                                     // add that instance to the display list, adding it to the Stage at 0,0
    
    // location
    myLoader.x = 590;                                        // move the loaded SWF 590 pixels to the right (from the left edge)   
    myLoader.y = 53;  
    // move the loaded SWF 53 pixels down from the top
    
    function unLoad (event:MouseEvent):void 
    {
        trace("click!");
        myLoader.unloadAndStop();
    }
    
    btn_home.addEventListener(MouseEvent.CLICK, unLoad);
    btn_home.addEventListener(MouseEvent.CLICK, GoToAndStop2);    // the function for this is on frame one

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial