View Full Version : Preloader Question
indiochano
02-21-2004, 01:29 AM
Hi... I recently made a preloader using the onclipevent action which scales the bar according to the percent loaded... My question is, I want to input text displaying at the 25% (saying loading text), 50% (saying loading graphics), 75% (saying loading colors) and 100% saying (saying done)... I have no idea where to put this in now that if I put it in the bar instance, the text gets all screwed up (since I aligned the bar to the left so that the bar could load and scale from left to right...)
Anyone plz help me :D
Thanks.
indiochano
02-21-2004, 01:33 AM
Also... I thought of making a new movie clip instance with the text of "loading text, loading graphics, loading colors and done" each at their respective percentage positions (frames 25, 50, 75 and 100)... The thing is how can I make the movie clip go at the 25th, 50th, 75th and 100th frame and stop when the movie is 25%, 50%, 75%, and 100% loaded?
boyzdynasty
02-21-2004, 01:34 AM
check out this tutorial http://www.actionscript.org/tutorials/intermediate/flash5_preloaders/index.shtml
indiochano
02-21-2004, 01:38 AM
Originally posted by boyzdynasty
check out this tutorial http://www.actionscript.org/tutorials/intermediate/flash5_preloaders/index.shtml
Check my second post... that's my big issue.. apparently the tutorial you linked was a basic preloader tutorial... I already know how to create the tutorial... but the problem is that I dunno how to make the preloader load, at certain percentage points, text saying for example: loading text (at frame 25), loading graphics (at frame 50), loading colors (at frame 75), and done (at 100)...
thanks.
boyzdynasty
02-21-2004, 01:41 AM
wow...that 2nd post was almost at the same time as my post...lol
ok...i'm not really sure what you are talking about...but why do you want preloaders for all that stuff?
indiochano
02-21-2004, 01:45 AM
Originally posted by boyzdynasty
wow...that 2nd post was almost at the same time as my post...lol
ok...i'm not really sure what you are talking about...but why do you want preloaders for all that stuff?
No, no i think you misunderstood me... That stuff i asked is supposed to be part of the preloader... lemme make this easier...
for instance, yer on the preloader and everthing's normal... the bar moves, the percent text is showing... then at 25 percent, i get the "loading text" text field... later at 50 percent, the "loading text" changes to "loading graphics".. and so on... that's what i want my preloader to do... spice things up a bit by telling the user that at the 25th percent point, text is being "loaded" (it's not being loaded but it makes the preloader a lot fancier)
thanks
boyzdynasty
02-21-2004, 01:47 AM
ok...but I think that is impossible if you are loading a clip as a one thing. When you do the percent preload thing, it looks at total bytes.
maybe there is a way...if you break down the piece by piece and loaded it into a seperate MC and get the totalbytes of that MC.
for example:
load textclip
totalBytes4AllMC = textclip.totalbytes
load image
totalBytes4AllMC += image.totalbytes...etc
indiochano
02-21-2004, 01:53 AM
Originally posted by boyzdynasty
ok...but I think that is impossible if you are loading a clip as a one thing. When you do the percent preload thing, it looks at total bytes.
maybe there is a way...if you break down the piece by piece and loaded it into a seperate MC and get the totalbytes of that MC.
for example:
load textclip
totalBytes4AllMC = textclip.totalbytes
load image
totalBytes4AllMC += image.totalbytes...etc
gonna try that.. thx
baby_annie
02-21-2004, 05:10 AM
I think u should use "IF" condition:
if(25% done) {
saySomething;
}
...
;)
boyzdynasty
02-21-2004, 10:42 AM
yea...but how do you which will be loaded? ...If you achieve, I would really like to know how....and probably others too.
maybe you can even write a tutorial on it...ok ok...i'm getting ahead of myself :D
indiochano
02-21-2004, 12:53 PM
I'm kinda confused here...
if(25% done) {
saySomething;
}
Dunno what to do with that code (i mean, dunno what to put in the script and dunno where to place the script :P)
boyzdynasty
02-21-2004, 01:48 PM
This is what I think our baby_annie is saying...
Take the totalbytes that needed to be loaded and determine what percentage it has loaded.
if(25% of the MC is loaded){
// something has loaded
}
else if(50% of the MC is loaded){
// another thing has finished loading
}
etc....
t-omen
02-21-2004, 02:05 PM
And in yet more simpler terms:
actBytes = mc.getBytesLoaded();
totBytes = mc.getBytesTotal();
percent = Math.round(actBytes*100/totBytes);
if (percent > 25) {
loadtext = "this";
}
if (percent > 50) {
loadtext = "that";
}
if (percent > 75) {
loadtext = "something";
}
if (percent == 100) {
loadtext = "alldone";
}
Not tested, but should work. You get the idea, I hope...
indiochano
02-21-2004, 02:28 PM
i'll try it let you guys know :D
indiochano
02-21-2004, 02:38 PM
Originally posted by t-omen
And in yet more simpler terms:
actBytes = mc.getBytesLoaded();
totBytes = mc.getBytesTotal();
percent = Math.round(actBytes*100/totBytes);
if (percent > 25) {
loadtext = "this";
}
if (percent > 50) {
loadtext = "that";
}
if (percent > 75) {
loadtext = "something";
}
if (percent = 100) {
loadtext = "alldone";
}
Not tested, but should work. You get the idea, I hope...
Ok, so what i did was place a blank keyframe and pasted the actionscript on the frame... then I placed a dynamic text field on the stage with the "loadtext" variable... this was all done in a scene where a preloader was present... ok.. so i go to test movie, bandwidth profiler and something goes wrong... the loadtext text field has "alldone" in it all the time... there's no text change from 25% to 50% and so on... dunno what to do... plz help me once again :D
t-omen
02-21-2004, 02:42 PM
there's a bug in my code... sorry.
correct is:
if (percent == 100) {
Does this help?
indiochano
02-21-2004, 02:50 PM
Originally posted by t-omen
there's a bug in my code... sorry.
correct is:
if (percent == 100) {
Does this help?
I spotted that bug :P
Nope... didn't help though :(
It's still displaying "alldone" all the time...
t-omen
02-21-2004, 02:53 PM
But you get the actual percentage displayed? If so, call with same symbol names should do the trick.
If you could post the code I'll take look at it (tomorrow) and try to figure out what's wrong...
indiochano
02-21-2004, 02:56 PM
Originally posted by t-omen
But you get the actual percentage displayed? If so, call with same symbol names should do the trick.
If you could post the code I'll take look at it (tomorrow) and try to figure out what's wrong...
Here's the code:
Frame 1: (layer: actions)
totalBytes = Math.round(getBytesTotal() / 1024);
loadedBytes = Math.round(getBytesLoaded() / 1024);
percentDone = Math.round((loadedBytes / totalBytes) * 100);
if (_root._framesloaded >= _root._totalframes) {
gotoAndPlay("start");
}
Frame 1: (layer: layer 2)
actBytes = mc.getBytesLoaded();
totBytes = mc.getBytesTotal();
percent = Math.round(actBytes*100/totBytes);
if (percent > 25) {
loadtext = "this";
}
if (percent > 50) {
loadtext = "that";
}
if (percent > 75) {
loadtext = "something";
}
if (percent = 100) {
loadtext = "alldone";
}
Frame 2: (layer: actions)
gotoAndPlay (1);
Thanks for everything :)
t-omen
02-21-2004, 03:05 PM
Check out my intro: www.likat.net/t-omen/point/intro.zip (http://www.likat.net/t-omen/point/intro.zip)
It's ~7 megs, but should get you started. there I have everything (but your 25,50,75... ;-)
Though I'll check this out and tell what I find.
indiochano
02-21-2004, 03:11 PM
Originally posted by t-omen
Check out my intro: www.likat.net/t-omen/point/intro.zip (http://www.likat.net/t-omen/point/intro.zip)
It's ~7 megs, but should get you started. there I have everything (but your 25,50,75... ;-)
Though I'll check this out and tell what I find.
thanks bro... ill check it out... thanks for everything
t-omen
02-22-2004, 09:55 AM
OK. Just tested and this one works. If not, reply and I'll post my .fla that does work.
Here goes:
[LAYER: ACTIONS]:
FRAME 1:
play();
loadMovie("index.swf",1);
FRAME 2:
(name this one as "loop", otherwise leave blank)
FRAME 3:
actBytes = _level1.getBytesLoaded() || 0;
totBytes = _level1.getBytesTotal() || 100;
percent = Math.round(actBytes*100/totBytes);
if (_level1.getBytesLoaded()<_level1.getBytesTotal()) {
bar._visible = true;
bar._xscale = percent;
if (percent>25) {
_root.perftext = "over 25";
}
if (percent>50) {
_root.perftext = "over 50";
}
if (percent>75) {
_root.perftext = "over 75";
}
if (percent==100) {
_root.perftext = "done";
}
gotoAndPlay("loop");
}
if (_level1.getBytesLoaded()>=_level1.getBytesTotal()) {
gotoAndPlay("end");
}
FRAME 4:
tellTarget(_level1) {
gotoAndPlay("1");
}
FRAME 5:
stop();
(You could also add _root.[component]._visible=false; to make sure nothing stays visible...)
[LAYER: BAR]:
FRAMES 1-5:
crete a movie displaying a load bar, name it "bar".
[LAYER: PERFTEXT]:
FRAMES 1-5:
Create a text frame, set it dynamic and variable as "perftext".
EDIT:
I did check my initial "answer"; it didn't work at all. So instead of repairing that, I've creted a new. This should be simple enough to just to help to get the idea...
indiochano
02-22-2004, 01:09 PM
I had some trouble with the code... can you post the .fla please?
Thanks for taking the time, I really appreciate it...
Thanks for everything.
t-omen
02-22-2004, 03:01 PM
Here you are.
indiochano
02-22-2004, 11:20 PM
thanks dude... :)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.