HOME | DD

Published: 2007-01-06 22:31:20 +0000 UTC; Views: 4402; Favourites: 66; Downloads: 0
Redirect to original
Description
Step by Step tutorial for hopefully anyone to understand adding in a simple loading bar to the first frame of there movie.Actionscript code to copy paste into bar movie clip:
onClipEvent(enterFrame) {
_root.stop();
PercentLoaded = _root.getBytesLoaded() / _root.getBytesTotal()*100;
if (PercentLoaded != 100) {
this._xscale = PercentLoaded;
} else {
_root.play();
}
}
Related content
Comments: 63
TalosAT In reply to ??? [2010-07-12 22:16:50 +0000 UTC]
I'm not really familiar with DA's preloader- but if you followed their instructions and it still isn't working right, you might be using the wrong version of actionscript? If you go File --> Publish Settings --> Flash Tab- you can see what version of actionscript you are using (should be either 2.0 or 3.0). But that is just a wild guess, it could be something else since I haven't used DA's preloader
👍: 0 ⏩: 1
BlueNala In reply to TalosAT [2010-07-15 20:21:45 +0000 UTC]
Well you can still see it on top of the other pics but thanks to what you said I poked round at it and worked out what I need to do :3
👍: 0 ⏩: 1
TalosAT In reply to BlueNala [2010-07-16 00:08:44 +0000 UTC]
Ahhh, poking around is usually the best way to fix something...... or make it a lot worse if you forgot to save beforehand
👍: 0 ⏩: 1
BlueNala In reply to TalosAT [2010-07-17 14:56:32 +0000 UTC]
Yes that would be bad if I didn't save
👍: 0 ⏩: 0
Elkaddalek [2009-05-11 20:46:52 +0000 UTC]
is ther a way 2 make a loader with a pecent bar.
like %50 loaded |///////------|
or an animated bar, like a hypodermic needel slowly enjecting the pecent loaded?
👍: 0 ⏩: 1
TalosAT In reply to Elkaddalek [2009-05-11 21:15:18 +0000 UTC]
Math.round(_root.getBytesLoaded() / _root.getBytesTotal()*100) will give you the percent without fractions that you can use to set the text of a dynamic text box. for example
[link] = Math.round(_root.getBytesLoaded() / _root.getBytesTotal()*100) + "% Loaded"; just make sure you give your dynamic text an instance name as for the animated bar, theres a few ways of doing that. one way is to make the bar a mask for your animated area- and then it will reveal the animation as it loads- (you can just mask the contents of the syringe for example) - as for making it start out full and empty... if you multiply your percent loaded by -1 then add +100 to it you should get the same result. ie 50% loaded = -50 + 100 = 50% visible, 25% loaded = -25 + 100 = 75% visible and so on.
👍: 0 ⏩: 0
MarioRoz [2008-08-04 22:18:20 +0000 UTC]
this is extremely useful, I always forgot the script for preloaders and they often does not work
👍: 0 ⏩: 1
TalosAT In reply to MarioRoz [2008-08-13 08:17:52 +0000 UTC]
Thanks, tried to make it as easy to use as possible
👍: 0 ⏩: 0
Project001Enyo [2008-05-14 15:25:38 +0000 UTC]
I cant seem to get mine to work.
Im a failure! T_T
👍: 0 ⏩: 1
TalosAT In reply to Project001Enyo [2008-05-15 07:13:08 +0000 UTC]
aw... what version of flash are you using and what version of actionscript? if your using one of the newer versions and using actionscript 3 it won't work. Needs to be Actionscript 2
👍: 0 ⏩: 1
Project001Enyo In reply to TalosAT [2008-05-15 13:10:17 +0000 UTC]
Well How do I get Actionscript 2?
👍: 0 ⏩: 1
TalosAT In reply to Project001Enyo [2008-05-15 17:07:36 +0000 UTC]
you either select it when you first start your .fla file or you can change it in file --> publish settings --> actionscript version
👍: 0 ⏩: 0
MewAnonymous [2008-03-21 21:22:52 +0000 UTC]
I have a problem...
When I go to put the actionscript on the bar it says "Current selection cannot have actions applied to it."
I'm not sure what I'm doing wrong.
Any ideas?
👍: 0 ⏩: 1
TalosAT In reply to MewAnonymous [2008-03-21 23:28:53 +0000 UTC]
Sounds like you turned it into a graphic instead of a movieclip. Make sure its a movieclip and see if that works? ^^
👍: 0 ⏩: 3
MewAnonymous In reply to TalosAT [2008-03-22 11:52:09 +0000 UTC]
I'm sorry for all the comments, but I got it to work. Turns out that I couldn't get it to work on a 3.0 document, but it worked on a 2.0 document. (or something like that)
Anyway, thanks, and sorry for bugging you!
👍: 0 ⏩: 1
TalosAT In reply to MewAnonymous [2008-03-22 18:09:51 +0000 UTC]
Ahhh~ That would make sense- AS 3.0 has alot of differences. Having that code on a graphic would have given the same error too though so thats what threw me off xD and its no problem- glad you got it figured out
👍: 0 ⏩: 0
MewAnonymous In reply to TalosAT [2008-03-22 11:35:47 +0000 UTC]
Nope, still doesn't work. >.<
I have the same problem with every tutorial I use.
Anyway...It really is a nice tutorial, and it's easy to understand, it's just that Flash doesn't like me.
👍: 0 ⏩: 0
MewAnonymous In reply to TalosAT [2008-03-22 11:29:14 +0000 UTC]
Alright, I'll try it, thanks!
👍: 0 ⏩: 0
Iced-over [2007-12-30 10:45:12 +0000 UTC]
Thanks for the awesome comprehensive tutorial, I will be following it soon and I will get back to you on it!
👍: 0 ⏩: 1
TalosAT In reply to Iced-over [2007-12-30 13:25:42 +0000 UTC]
no problem, glad to be of help
👍: 0 ⏩: 0
Joehhzeh [2007-08-25 05:26:50 +0000 UTC]
Wow, this is SO EASY!
Haha. I've been looking at all the really complicated loading screens, and they don't work for me.
I'm just uploading something right now so I'll get back to you with a link if it works
Thankyooooo!
👍: 0 ⏩: 2
TalosAT In reply to Joehhzeh [2007-08-25 13:22:57 +0000 UTC]
hehe good luck with it No problem, glad to be of service.
👍: 0 ⏩: 0
HanakoFairhall [2007-07-25 21:04:54 +0000 UTC]
Does this work for Flash MX 2004? (Not be confused with Flash MX, that was made in 2001-02)
👍: 0 ⏩: 1
TalosAT In reply to HanakoFairhall [2007-07-26 00:45:26 +0000 UTC]
Should work with all version of flash. I've tested it in flash MX and flash CS3....
👍: 0 ⏩: 1
HanakoFairhall In reply to TalosAT [2007-07-26 01:25:38 +0000 UTC]
Okay then, I'll give it a shot
👍: 0 ⏩: 1
TalosAT In reply to HanakoFairhall [2007-07-26 08:56:53 +0000 UTC]
Okie, good luck :> if you have any problems with it let me know
👍: 0 ⏩: 1
Nick-Husky [2007-07-16 13:51:20 +0000 UTC]
it says:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement block must be terminated by '}'
onClipEvent(enterFrame) {
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 8: Syntax error.
}
Total ActionScript Errors: 2 Reported Errors: 2
what do i wrong? -_-''
👍: 0 ⏩: 1
TalosAT In reply to Nick-Husky [2007-07-16 20:13:22 +0000 UTC]
hmm... try deleting the action script and copy pasting it again- make sure you get all the } in there- theres two at the end
👍: 0 ⏩: 1
Nick-Husky In reply to TalosAT [2007-07-16 20:25:29 +0000 UTC]
hey, never midn. I have it now already
Merci beaucoup ^^
👍: 0 ⏩: 1
Nick-Husky [2007-07-16 13:15:14 +0000 UTC]
stupid send button
This is very useful and nice! I hope i can use it much =3
(excuse my lil bad english :3)
👍: 0 ⏩: 0
dado24 [2007-03-10 00:45:01 +0000 UTC]
great,,, i've been looking for this tutorial most of my life.
👍: 0 ⏩: 1
AngelCrusher [2007-01-09 21:18:38 +0000 UTC]
cool man, i kinda understand. ^_^
How does the computer know to make the bar longer?
👍: 0 ⏩: 1
TalosAT In reply to AngelCrusher [2007-01-10 05:41:18 +0000 UTC]
what it does it takes how many kilobytes are loaded (let's say 25 kbs) then divides that by the size of your flash (lets say its 100 kilobytes to make this easy) - thus resulting in 0.25, multiplies that by 100 resulting in 25 telling it that 25% is loaded- it then sets the scale of the width (_xscale) to the percentage that you just got
👍: 0 ⏩: 1
| Next =>