Testing if an external swf is already loaded

Hi all,

I’m having a bit of trouble using a function that loads external swf’s into the main movie. The function works fine, but I want to expand it to test if a movie is already loaded. Here is the actions for the button that loads the movie:

on (release) {
_root.movieloader(“Image.swf”);
}

and here is the function in the main timeline of the movie:

function movieloader(name){
loadMovie(name, _root.maincontent);
} //where maincontent is the destination MC

Any ideas on how I can incorporate some sort test to see whether a movie has been loaded already? I want to avoid clicking on the button multiple times and having it reload each time.

Thanks in advance!:slight_smile:

This isn’t tested, but I believe this should work…

…make a boolean variable, set it to true when u load the movie, (and if u do have a button that lets the user close the swf, then don’t forget to change the variable to false when u unload the movie)…

good luck

I see what your getting at. It would work if I had the button to unload because I could then set the boolean to false, but I don’t have that button. Basically its a menu that opens different menu items in the main screen, it wouldn’t really work well if I made the user unload each swf.

I’m going to try passing a variable to another function to test whether it is loaded before it gets to the load movie function… perhaps I can get around it that way. Any other suggestions are welcome.

hi,

add a small preload with your function

may be like

function movieloader(name){
loadMovie(name, _root.maincontent);
movieLoaded=false
while(movieLoaded==false){

     if(_root.maincontent.getBytesLoaded>=_root.maincontent.getBytesTotal){
         movieLoaded=true
        
    }
    // here you can have a preloader also;

}
}

there is one more way that is creat a loader object, the same way XMl works.

Movie=new loadMovie()
// this way variable i have taried but movie not yet

Regards
ajo
ajok@indiatimes.com