Skip navigation
ngourlie
Currently Being Moderated

External SWF won't leave.

Mar 22, 2012 12:56 PM

Tags: #issue #swf #load #unload #flash_site

So I am trying to make a new flash website for my portfolio (Using Flash Pro CS5.5 with Actionscript 3.0). Obviously to save on load times when someone clicks a portfolio category I want an external SWF to load in and once they leave that page to go back, I want it to go away. Seems simple, yet once my SWF loads, it will not disappear. Here is the link: http://www.nickgourlie.com/flashsite.html To find the problem area click "Portfolio" then "Graphic Design" then "Graphics." My SWF then loads correctly but once you click back to the portfolio or anywhere else, the SWF stays loaded in the background. How do I unload it??

 

Here is my code where "GraphicsScroller" is my external SWF:

--------------------

var myLoader:Loader = new Loader();

var url:URLRequest = new URLRequest("flashfiles/GraphicsScroller.swf");

myLoader.load(url);

addChild(myLoader);

 

 

// (optional)

myLoader.x = 125;

myLoader.y = 132;

-------------------

 

Also if you have a better load/unload code that would be better in this situation let me know. I've been messing with different codes for a few days now and I am getting pretty frustrated.

 

Thanks for any help!

 
Replies
  • Currently Being Moderated
    Mar 22, 2012 4:38 PM   in reply to ngourlie

    I don't see anything that would unload the loaded file.  You should have a line like...

     

    myLoader.unload();  

    removeChild(myLoader);

     

    somewhere, such as in code for any buttons that could be clicked to changes sections.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 23, 2012 4:33 AM   in reply to ngourlie

    In case you are using the timeline for the different sections, when you dynamically add content it has nothing holding it to the timeline unless you add it to something that was not dynamically created that lives in the timeline, such as an empty movieclip that you manually place on the stage.  If the dynamically added content is not anchored to something then it will persist throughout the timeline.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2012 5:02 AM   in reply to ngourlie

    Change...

     

    addChild(myLoader);

     

    to

     

    yourMovieClip.addChild(myLoader);

     

    Where "yourMovieClip" gets replaced with whatever name you assign to the empty movieclip.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points