Hi, ive managed to import files into a main fla document using a moviecliploader command. The code tracks the percentage of the file downloaded so far and shows this information in a preloader bar. The problem is whenever I import a swf file it tries to play before it is 100% loaded. To counter this I added some more code to solve this (see bold text). The code is supposed to hide the swf file until it is 100% loaded then show and play it. The code hides and shows the swf fine, but still seems to play the file in the background. Would really appreciate some help with this one, hear is the code:
loadbar._visible = false;
//set up a MovieClipLoader and a Listener for "listening" to the callback events of the MovieClipLoader
var myLoader:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadStart = function(){
trace ("started loading" );
}
myListener.onLoadProgress = function(){
percent = Math.floor(box5.getBytesLoaded()/box5.getBytesTotal() * 100);
loadbar._visible = true;
loadbar.gotoAndStop( percent );
trace ( percent );
//script to ensure that the movieclip is only displayed and played when it is 100% loaded
if (percent < 100){
gotoAndStop(box5);
box5._visible = false;
} else {
box5._visible = true;
gotoAndPlay(box5);
}
}
myListener.onLoadComplete = function(){
trace ("loaded");
loadbar._visible = false;
}
// add the listener object to the movieCLipLoader
myLoader.addListener(myListener);
myLoader.loadClip ("materials/rotoscope.swf" , box5);
stop();
Thanks in advance,
Martin