Skip navigation
Currently Being Moderated

How to use UnloadMovie on an onload Event

Sep 17, 2010 11:57 AM

hi. i have this code that load on a keyframe

loadListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void  {

info.text = Math.round((bytesLoaded/bytesTotal)*100)+"%";

};

loadListener.onLoadInit = function(target_mc:MovieClip):Void  {

info.text = "";

};

var mcLoader:MovieClipLoader = new MovieClipLoader();

mcLoader.addListener(loadListener);

mcLoader.loadClip(swf_path, swf_loader3);

 

i want on every other keyframe to load this:

swf_loader.unloadMovie();

 

Because the swf_loader are mp3 player and if i change page wihout having press the stop button first the music is still playing.

I have try to just add swf_loader.unloadMovie(); on every other keyframe but it doesnt work. i guess i have to find out where this swf_loader exist/is included right? how i can do that?

 
Replies
  • kglad
    62,117 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 17, 2010 1:19 PM   in reply to Ex0skelet0r

    in addition to the errors in you message, unloading that swf isn't likely to stop the sound being played in that swf.

     

    what will probably work better for you is to

     

    1.  explicitly stop the sound stream in your loaded swf before navigating away from that frame or

     

    2.  use stopAllSounds() when navigating away from that frame.

     
    |
    Mark as:
  • kglad
    62,117 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 17, 2010 2:05 PM   in reply to Ex0skelet0r

    you'll need to use both the load-target movieclip and the sound instance name to stop the sound.  so, if your sound instance is created on the main timeline of the loaded swf:

     

     

    swf_loader3.soundname.stop();

     
    |
    Mark as:
  • kglad
    62,117 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 17, 2010 4:46 PM   in reply to Ex0skelet0r

    you're welcome.


     
    |
    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