Here is a function I am using in a current project, I am using loadClip rather than Load movie so that I can get the progress of the loading and read it back to a progressbar. to my knowlage loadMovie will not do this. you would simply call this such as.
_root.loadMoviesPlease("test.swf","_root","http://.yaddayadda.com/");
I would put this in an actions layer at the begining of the movie
function loadMoviesPlease(movie,instance,my_url){
var my_back:MovieClip = instance.createEmptyMovieClip("back_drop",-50000);
var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadProgress = function(target,loaded,total){
_root.loader_mc.percent.text = Math.round((loaded / total)* 100) +"%";
}
mclL.onLoadInit = function(){
_root.loader_mc._visible = false;
_root.loader.percent.text = "";
_root.background_image.text = "I got here";
}
mcl.addListener(mclL);
_root.loader_mc._visible = true;
var my_clip = mcl.loadClip(my_url+movie, my_back);
}
- function loadMoviesPlease(movie,instance,my_url){
- var my_back:MovieClip = instance.createEmptyMovieClip("back_drop",-50000);
-
- var mcl:MovieClipLoader = new MovieClipLoader();
- var mclL:Object = new Object();
-
- mclL.onLoadProgress = function(target,loaded,total){
- _root.loader_mc.percent.text = Math.round((loaded / total)* 100) +"%";
- }
- mclL.onLoadInit = function(){
- _root.loader_mc._visible = false;
- _root.loader.percent.text = "";
- _root.background_image.text = "I got here";
-
- }
- mcl.addListener(mclL);
- _root.loader_mc._visible = true;
- var my_clip = mcl.loadClip(my_url+movie, my_back);
-
- }
Now you notice that the first thing I do is createAn Empty Movie Clip. This is not completely nessassry, I just seem to have an easier time in AS using a movie Clip created in AS, you could point toward an existing movie Clip Such as one you have listed under the name of holder....but you need to know it's full path. To find that path simply to to the desire movie clip instance and click on it and add the following code in tha actions panel.
on(release){
trace(this);
}
- on(release){
- trace(this);
- }
Test movie, now click on the desire spot it will squeal like a pig and tell you its path. something like
_level0.my_holder_clip. Copy that down and remove that Code from the clip. Now you can call the function like this from anywhere in your flash movie, following the dry policy (Do Not Repeat Yourself).
_root.loadMoviesPlease("test.swf",_level0.my_holder_clip, "http://.yaddayadda.com/");