Jump to content

[SOLVED] Help with a preloaded for loadMovie


Recommended Posts

 

Hi,

 

I am trying to set up a preloader that will be used while I am loading movies in to a blank movie clip. I think my actionscript makes sense, and it works when I test it through Flash, but doesn't work when I view it online. Can anyone see where I am going wrong?

 

When a button on my movie is clicked, it tells the 'container' movie to play. Here are the actions I have within 'container':

Frame 1:
stop();

Frame 5:
loadMovie('print_test.swf', this.print_page_03_container);

Frame 7:
var bytes = this.print_page_03_container.getBytesTotal();
var bytes_loaded = this.print_page_03_container.getBytesLoaded();
if (bytes_loaded == bytes) {
	//_root.gotoAndPlay(2);
	gotoAndStop(9);
} else {
	gotoAndPlay(6);
}

 

On Frame 9 I have the word 'loaded' so I can see when the timelines arrives there. The problem is, when I view it online, I gets to frame 9 even though print_test.swf hasn't fully loaded. Perhaps it is checking if the container (this.print_page_03_container) has loaded, rather than the actual movie inside it too (print_test.swf)?

 

 

look into using movieClipLoader..its has listeners tied to it like, onLoadStart, onLoadComplete and onLoadProgress. Basically set it up like this:

 

var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mcl.addListener(mclL);

mcl.loadClip("print_test.swf",target) //target is where you want it to load. Next you can do:

mclL.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
amount = Math.floor(((bytesLoaded/bytesTotal)*100));
percent_text.text = amount; //assuming you have a text field called percent_text it will display the % loaded
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.