Make a loading bar in flash with width of 100 and make it a movieclip and give it an instance name (preloadBar). Take a Dynamic text field and give it an instance name (input). Don't make it a movieclip. Give a variable name "txtPercent".
RIghtclick on the movieclip loading bar and paste this action
i followed the steps but it wont work... the bar wont load.. and i encountered an error..
**Error** Scene=Scene 1, layer=preloader, frame=1:Line 1: Clip events are permitted only for movie clip instances
onClipEvent (load) {
**Error** Scene=Scene 1, layer=preloader, frame=1:Line 4: Clip events are permitted only for movie clip instances
onClipEvent (enterFrame) {
**Error** Scene=Scene 1, layer=preloader, frame=1:Line 7: There is no method with the name 'Floor'.
Percent = Math.Floor(Number(loaded)/Number(Total)*100);
You have to place the code on the movieclip itself not the timeline frame
and the word "Floor" in Math.Floor should read "Math.floor" i.e. lower-case "f"
i tried doin it again but it wont still work.. yes, there were no errors now..
i played it, opened the bandwidth profiler, and simulate a 56k modem.. the 100px bar did not move from 1-100, the dynamic txt cant be seen, and it was stuck in the first frame. even if the whole movie was already downloaded, it wont go to frame 2..
=======
what i did was:
Make a loading bar in flash with width of 100 and make it a movieclip and give it an instance name (preloadBar).
i did understand that perfectly! i made a new layer and followed the instructions..
Take a Dynamic text field and give it an instance name (input). Don't make it a movieclip. Give a variable name "txtPercent".
i made a new layer and clicked the TEXT button. i clicked once on the stage, then changed it to dynamic text, name that instance 'input'. i didnt make it a movie clip, i just left it as is.. (did i do something wrong here?) then i gave it a txtPercent var name.
====
what i noticed is that:
when i simulated a 56k modem, it stuck in the 1st frame, no animation at all! but when i simulated a DSL/Cable modem, it played the movie after it was loaded. BUT, the bar didnt animate and i didnt see the dynamic text..
could someone tell me whats wrong with this!? thanks! :P
zappakate, and duayne Here is a way to make your preloader work. I'm quite sure a lot of this you already know
Place a "stop()" on the first frame of the root timeline.
On frame 1, place something heavy in bytes on the stage to preload, and place a "stop()" on frame 2 of the root timeline.
Create a movieclip of a bar that is 100 pixels in width (long).
Make sure the x axis (the far left corner) of the bar is at 0.
place your new bar movieclip on the stage
place this code on the movieclip, not the timeline.
Code:
onClipEvent (load) {
this._width = 0;
}
onClipEvent (enterFrame) {
L = _root.getBytesLoaded()/1000;
T = _root.getBytesTotal()/1000;
P = Math.floor((L/T)*100);
this._width = P;
_root.txtPercent = P+" %";
if (P == 100) {
_root.nextFrame();
}
}
To check the preloader hit "Ctrl Enter" Then hit it again to watch the preloader do it's thing. I hope I didn't leave anything out.
Good Luck
A Fool is someone who keeps repeating the same thing, the same way, over, and over and expecting a different result
I have made you basic preloader, the fla has 2 scenes, preload and movie, place your content on this scene, or copy the preload bar and the AS on frame one into your movie, and take some time to see how it works
woah!! it definitely worked!!! thanks ryantsi!!! i owe you one...
but what would i do if i want to have a dynamic text percent loaded?
i tried making a new layer.. get my TYPE tool. clicked once in the stage (i didnt type anything in it), and made it a dynamic text. then gave it a var name of percent(as indicated in the script u gave me. but i still didnt see the text when i simulated the download..
how would i do this? thanks
*i think whats important in actionscripting is that you should know what exactly is going inside the script, right? dont just copy and paste the scripts you get in the net. in my case, i know how the script works, and i understand it. but i just dont know why im not getting it right. and thanks to you, i have the working script now... ill try and learn more AS as i go along my flash lessons.*
thanks again.. and i hope you would still help me with this last preloader problem.. :P