Skip to main content
juresti
Known Participant
February 16, 2011
Answered

loadMovie how to know which is loaded

  • February 16, 2011
  • 1 reply
  • 1428 views

I'm loading many movies in a moan movie into mc instance name "movieHolder" I need something to happen only IF the first movie is not loaded. How can I check WHAT movie is currently loaded in movieHolder?

I guess I could set / pass a varialble?

Any help is appreciated!!!

This topic has been closed for replies.
Correct answer kglad

you can use the _url propery of movieclips to see what's loaded into the target movieclip.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
February 17, 2011

you can use the _url propery of movieclips to see what's loaded into the target movieclip.

juresti
jurestiAuthor
Known Participant
February 17, 2011

The only way I can get the url or do anything is if the movie is loaded. I'm using loadmovie and I dont know how to know when it is loaded and then get the url and then it it is a particular url then do something.

juresti
jurestiAuthor
Known Participant
February 17, 2011

I tried adding code to the preloader function still doesnt work.

stop();
// this function runs the preloader
// it is to be used with the onEnterFrame
// of the preloader animation
function preloadContainer(){
   
    // get bytes loaded and total from container_mc
    var bytes_loaded = movieHolder.getBytesLoaded();
    var bytes_total = movieHolder.getBytesTotal();
    var urlString:String = movieHolder._url
    var filename:String = urlString.substring(urlString.lastIndexOf("/")+1, urlString.length);
   
    // stop and hide the movie so it wont play or
    // be seen while progressively downloading
    // (keep trying if it exists or not just to be sure)
    movieHolder.stop();
    movieHolder._visible = false;
   
    // if bytes_total is a valid number and greater than 0
    if (bytes_total > 0){
       
        // get percent loaded
        var percent_loaded = bytes_loaded/bytes_total;
       
        // update the value in the preloader
        preloader_mc.value = percent_loaded;
           
        // check if preloading is complete
        if (percent_loaded == 1){
           
            // play and show the container clip
            movieHolder.gotoAndStop(1);
            movieHolder._visible = true;
           
           trace(movieHolder._url);
            //trace(filename);
            if (filename == "ShopOutsideAnim01.swf") {
            trace("nooo");
            }
            else {
                attachMovie("buttonblank", "butt_blank", 2, {_x: 22, _y: 5});
            butt_blank._alpha = 50;
            }

            // remove the preloader movie clip
            preloader_mc.removeMovieClip();
           
            // delete the onEnterFrame event handler running this function
            delete onEnterFrame;
        }
    }
}