0 members and 2,535 guests
No Members online

» Site Navigation
» Stats
Members: 35,442
Threads: 103,075
Posts: 826,688
Top Poster: cc.RadillacVIII (7,429)
|
-
ok... so i m making this movie, right? i m making the preloader and i am like || this close to making it work :P but i need someone's help because the script isnt working properly. here is the script i put in frame one of layer 1 of the preloader scene :
Code:
total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
if (loaded_bytes == total_bytes) {
****gotoAndStop(2);
} else {
****gotoAndPlay(1);
}
frame 2 has the play button. so whats happening is that when i start the movie it skips the preloader :/. only loads part of the movie and comes to frame 2, only shows the preloader for like 1 sec. the movie is 28 scenes long (dont ask y), it has hundreds of symbols, like movie clips, graphics, and buttons; its not suppose to take like 1 sec to load the whole movie. if you are good at flash or know how to work a preloader plz tell me thnx. .
-
Could be in your code.
Like your if/else statements..
First of all....
What does gotoAndStop() do?
What does gotoAndPlay() do?
I'll assume that gotoAndPlay() plays the movie :P, and if that is the case, then it will execute without actually loading the bytes since its in the else construct. So thats probably why it will play without finishing loading.
-
<div class='quotetop'>QUOTE(Shurai @ Apr 22 2006, 08:29 PM) [snapback]166522[/snapback]</div>
Could be in your code.
Like your if/else statements..
First of all....
What does gotoAndStop() do?
What does gotoAndPlay() do?
I'll assume that gotoAndPlay() plays the movie :P, and if that is the case, then it will execute without actually loading the bytes since its in the else construct. So thats probably why it will play without finishing loading.
[/b]
ok.. i will explaing you the whole code.
this is the whole code:
Code:
total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
if (loaded_bytes == total_bytes) {
****gotoAndStop(2);
} else {
****gotoAndPlay(1);
}
this:
Code:
total_bytes = _root.getBytesTotal();
tells flash to get the total number of bytes of the file
this:
Code:
loaded_bytes = _root.getBytesLoaded();
tells flash to get the number of bytes already loaded
this:
Code:
percent_done = int((loaded_bytes/total_bytes)*100);
tells flash to write 0.100 % in a text box on the stage.
this:
Code:
bar.gotoAndStop(percent_done);
tells the load bar to to show frames 1-100 of the loade bar movie clip.
this:
Code:
if (loaded_bytes == total_bytes) {
****gotoAndStop(2);
}
tells flash to see if total bytes and the number of bytes loaded is equal or not, and if it is, it tells it to go to and stop at frame 2 of scene 1.
this:
Code:
else {
****gotoAndPlay(1);
}
tells flash to go to and play frame 1 of scene one if the total bytes and bytes loaded isnt same.
so far to me it looks goo dbut if anyone knows better plz tell me how to fix my problem.
i might know what the problem is but i donno one of the code component (if it esists) to fix it..... does anyone know a script component which is the opposite of "=="? i.e == means "equal" so the other one should mean "does not equal".........
-
forlfrof all you needed to do was tell me what those two objects do :P The only reason I replied was that actionscript syntax looks similar to other languages I've dealt with.
i might know what the problem is but i donno one of the code component (if it esists) to fix it..... does anyone know a script component which is the opposite of "=="? i.e == means "equal" so the other one should mean "does not equal".........
[/b]
!= is not equals in normal coding conventions.
<div class='quotetop'>QUOTE(Virulent @ Apr 22 2006, 07:57 PM) [snapback]166528[/snapback]</div>
this:
Code:
percent_done = int((loaded_bytes/total_bytes)*100);
tells flash to write 0.100 % in a text box on the stage.
[/b]
The fact that the 'int' is there specifies that there isn't a decimal point.
12.3 loaded bytes/100 total bytes = 0.123*100 = 12.3% = int(12.3) = 12
I think I figured it out...
There is definitely a problem with this part:
Code:
bar.gotoAndStop(percent_done);** //go to current percentage, innocent enough..
if (loaded_bytes == total_bytes) {****//will never get taken since the current never reaches total
****gotoAndStop(2);
} else {************************** //will always be taken
****gotoAndPlay(1);********//jump back to first frame?!?!??! This is a very disgusting way of "looping?" and doesn't work.
}
Can you even do loops in Flash since there are frames?? I dunno. Making 100 frames is a waste of time. You can scale the progress bar size you know.
Try this bit:
Code:
if(percent_done != total_percent){**************** //total_percent = 100;
********setProperty(bar,**_xscale**, percent_done)
}
else{
********goAndStop(2);
Give it a shot. You'll have to play around with it muah.
-
//jump back to first frame?!?!??! This is a very disgusting way of "looping?" and doesn't work.[/b]
lol i found this this code in all tuts i saw :P.
yea i know i can scale it but i wanted it to be more smoother :P.
btw i dont get this:
"total_percent"....... whats that for? is it same as total_bytes? btw percent_done is the instance name of the dynamis text inwhich the percent is shown also the var of the text :P.
i donno.. i will try it later lol. i m too lazy to do i right now. thnx for ur hep tho .
-
Yup, total_percent is just a constant I made up.
You'll probably need it if you choose to do scaling. Its just 100 XD
-
<div class='quotetop'>QUOTE(Shurai @ Apr 23 2006, 12:00 AM) [snapback]166536[/snapback]</div>
Yup, total_percent is just a constant I made up.
You'll probably need it if you choose to do scaling. Its just 100 XD
[/b]
right so is this needed in the code?
Code:
//total_percent = 100;
lol i am a lil confused... cant you post the whole code i should put? i donno what to remove from my code and where to add what u gave me. thnx .
-
<div class='quotetop'>QUOTE(Shurai @ Apr 22 2006, 11:36 PM) [snapback]166533[/snapback]</div>
forlfrof all you needed to do was tell me what those two objects do :P The only reason I replied was that actionscript syntax looks similar to other languages I've dealt with.
!= is not equals in normal coding conventions.
The fact that the 'int' is there specifies that there isn't a decimal point.
12.3 loaded bytes/100 total bytes = 0.123*100 = 12.3% = int(12.3) = 12
I think I figured it out...
There is definitely a problem with this part:
Code:
bar.gotoAndStop(percent_done);** //go to current percentage, innocent enough..
if (loaded_bytes == total_bytes) {****//will never get taken since the current never reaches total
****gotoAndStop(2);
} else {************************** //will always be taken
****gotoAndPlay(1);********//jump back to first frame?!?!??! This is a very disgusting way of "looping?" and doesn't work.
}
Can you even do loops in Flash since there are frames?? I dunno. Making 100 frames is a waste of time. You can scale the progress bar size you know.
Try this bit:
Code:
if(percent_done != total_percent){**************** //total_percent = 100;
********setProperty(bar,**_xscale**, percent_done)
}
else{
********goAndStop(2);
Give it a shot. You'll have to play around with it muah.
[/b]
it didnt work....... it was weired.. the load bar disappeared lol.
-
Code:
total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
percent_done = int((loaded_bytes/total_bytes)*100);
if(percent_done != 100){****
********setProperty(bar,**_xscale**, percent_done)
}
else{
********goAndStop(2);
Try that *//total_percent = 100* was just a comment.
Similar Threads
-
Replies: 4
Last Post: 06-26-2005, 02:21 PM
-
By streetsoulja in forum The Void
Replies: 17
Last Post: 04-19-2005, 04:47 AM
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
|