-
Help with loader ...
Hi,
I am almost finished with a basic flash site. I created 1 FLA file with each 'page' being it's own movie. For each page I am calling the swf file that was created, what I want to do is put separate loaders in for those but I cannot figure out how to do it? Most are small but a few are larger ... I did the loader for the main moview but cannot figure out how to do it for the individual movies (swfs) that are loaded when user clicks a button.
Pardon my inexperience - any help is greatly appreciated!!!
Jen
-
are you loading your swfs into mc's or levels? preloading isn't really any different when loading swfs. Here's an example, i've included some comments to help you understand it:
PHP Code:
//create an mc to load your swf in to
this.createEmptyMovieClip("container", this.getNextHighestDepth());
//load the swf
container.loadMovie("somefile.swf");
this.onEnterFrame = function(){
//some variables to display/utilize the preloader
loaded = container.getBytesLoaded();
total = container.getBytesTotal();
percent = Math.floor(loaded/total *100);
//display the percent loaded so you know it's working
trace(percent);
//if the file it loaded removie the onEnterFrame to free up resource
if(percent >= 100){
delete onEnterFrame;
//do anything you want now that hte swf is loaded
}
}
-
Thank you! I was just working on it and realized, some of the original code for the main movie had _root so once I removed, it worked fine ... ugh, I figured it would be something small.
Thanks for your code, I will look at that too ...