-
I am trying to make my first preloader and seem to be having some kind of problem with the code if anyone could help me
this is the script
code is
loadPercent = (Math.floor (_root.getBytesLoaded() / _root.getBytesTotal() * 100) + "%");
loadBytes = (Math.round((_root.getBytesLoaded() / 1024) * 1000) / 1000) + " Kb of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded ");
if (_root.getBytesLoaded() == _root.getBytesTotal()){ loadPercent = "100%";
loadBytes = (Math.round((_root.getBytesLoaded() / 1024) * 1000) / 1000) + " Kb of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded ");
}else{
//what frame is labled "button"? is it the 2nd Frame?
gotoAndPlay("Button");
}
the error is .................................................. .......................
Error
Scene=Scene 1, Layer=actions, Frame=2: Line 2: ';' expected
loadBytes = (Math.round((_root.getBytesLoaded() / 1024) * 1000) / 1000) + " Kb of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded ");
Please help me out I can't find where the darn ";" is supposed to be I know that ; is supposed to end a statement but that's one fluid statement in my actionscript.
well thnxs for any help you can offer
-
HELP>>>ACTIONSCRIPT DICTIONARY
you had some parentheses that were throwing Flash off:
Code:
loadPercent = Math.floor (_root.getBytesLoaded() / _root.getBytesTotal() * 100) + "%";
loadBytes = Math.round((_root.getBytesLoaded() / 1024) * 1000) / 1000 + " Kb of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded ";
if (_root.getBytesLoaded() == _root.getBytesTotal()){
loadPercent = "100%";
loadBytes = Math.round(((_root.getBytesLoaded() / 1024) * 1000) / 1000) + " Kb of " + Math.round(((_root.getBytesTotal() / 1024) * 1000) / 1000) + " Kb total Loaded " ;
}else{
//what frame is labled "button"? is it the 2nd Frame?
gotoAndPlay("Button");
}
original code : missing an opening parentheses after the first Math.round
loadBytes = (Math.round((_root.getBytesLoaded() / 1024) * 1000) / 1000) + " Kb of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded ");
First ( gets moved to after the Math.round and the last ) gets removed period.
loadBytes = Math.round(((_root.getBytesLoaded() / 1024) * 1000) / 1000) + " Kb of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded ";
I suppose you could do this too:
loadBytes = (Math.round(((_root.getBytesLoaded() / 1024) * 1000) / 1000) + " Kb of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded ");
It isn't necessary to surround the whole thing in ( ) but you can if you want to.
Anyway, make sure your parentheticals open and close properly.
Good Luck!
-
thanks a ton got my preloader up and running due to your help
thnxs again
-
HELP>>>ACTIONSCRIPT DICTIONARY
Good Job!
You're welcome, I'm glad to help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|