Ultrashock Forums > Flash > ActionScript
As modifying help

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
As modifying help
Old 2003-05-13

preloading levels in a flash movie


this is my preloader for my flash movie:

onClipEvent (load) {

tkb = _root.getBytesTotal();

}

onClipEvent (enterFrame) {

p = Math.round((_root.getBytesLoaded()/tkb)*100);

_root.percent = p;

if (p == 100) {
_root.play();
}
}


Now I want to add a sound file on level 2 of this movie, but how can the percentage be corrected so it takes my base fla and external swf into consideration?

onClipEvent (load) {

tkb = _root.getBytesTotal();
loadMovieNum ("sound.swf" , 2); //this is my sound file being loaded into level 2
}

onClipEvent (enterFrame) {

p = Math.round((_root.getBytesLoaded()/tkb)*100);

_root.percent = p;

if (p == 100) {
_root.play();
}
}
hrooken
postbit arrow 1 comment | 79 views postbit arrow Reply: with Quote   
Registered User
Ryu2002 is offline
seperator
Posts: 106
2001-10-31
seperator

Ultrashock Member Comments:
Ryu2002 Ryu2002 is offline 2003-05-13 #2 Old  
I fixed up the code but for some reason the percentage loaded seems to stop at 57%


onClipEvent (load) {


tkbTotal = _root.getBytesTotal()+_level2.getBytesTotal();
tkbLoaded = _root.getBytesLoaded()+_level2.getBytesLoaded();
loadMovieNum ("sound.swf" , 2);


}

onClipEvent (enterFrame) {

p = Math.round((tkbLoaded/tkbTotal)*100);

_root.percent = p;

if (p == 100) {
_root.play();

}
}
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: