Welcome to the Geeks & God Static Archive. Read more »

Flash Preloader

Joined: 11/28/2008

hey guys...
I'm working on creating a preloader bar in Flash MX.
I've searche extensively for a good tutorial on the web. Most are for flash 4 or 5.

Can anyone help out with a simple preloading bar.
I had made one earlier (not a bar / but still a preloader)
check that here: (this was a joke from the general chat forum of what kind of music do you like)
http://www.polvero.com/flash/playing.htm

I'd like to have one with a status bar...
it doesn't need to have a percentage var w/ it. just a bar going from left to right...
that's it...that's all! and I can't do it....well, i could...but with someone elses help.
Thanks in advance.
In his love

Joined: 11/28/2008
Hi DustinI think the

Hi Dustin

I think the principle most pre-loaders work on (well the ones with status bars) is working out the total file size, spreading that size over a number of frames at the start, and then incrementing the %loaded as each starting frame is loaded, eg:

|Frame 1 - photo - 10% of size|
|Frame 2 - sound loop - 40% of size|
|Frame 3 - Nav icons - 25% of size|
etc

That's kind of simplistic, but as each frame loads, put some action script in each that adds that frame's % to the total loaded. Then, to make the bar, create a movieclip (name it progressbar or asomething) and resize it according to the % loaded at each frame.

Paul

Paul Davey
Whitford Church
"Everyone who calls on the name of the Lord will be saved." Romans 10:13
"For all have sinned and fall short of the glory of God, and are justified

Joined: 11/28/2008
i mainly need the actions

i mainly need the actions scripts. that's what i'm looking for. I'm not so familiar with the scripts in flash.
I know how to make a bar move...shape tweens, & motion tweens. that's all very simple. I just need to make it do the percent stuff...

Joined: 11/28/2008
Well, you just use a variable

Well, you just use a variable on level0 (eg _level0:percentloaded) and increase it in each frame.

|Frame 1: setvariable("_level0:percentloaded") = 10|
|Frame 2: setvariable("_level0:percentloaded") = _level0:percentloaded + 40 |
|Frame 3: setvariable("_level0:percentloaded") = _level0:percentloaded + 25 |
|Frame 4: setvariable("_level0:percentloaded") = _level0:percentloaded + 25 |

Just using the values from my previos post. Then, as each frame loads (containing the appropriate proportion of the file size), use the _level0:percentloaded variable's value to resize the progress bar.

I don't think you want to do motion tweening, just do this each frame (movieclip whose instance name is progressbar:

Tell Target (_level0/progressbar)
SetProperty(_width) = 400 * (_level0:percentloaded/100)
End Tell Target

I'm a bit rusty on the syntax, since I don't have it in front of me, but that's the basic idea.

Paul Davey
Whitford Church
"Everyone who calls on the name of the Lord will be saved." Romans 10:13
"For all have sinned and fall short of the glory of God, and are justified

Joined: 11/28/2008
ok...maybe i'm being

ok...
maybe i'm being unclear.
I don't want the progress of the movie.
I'm looking for something that tells me how much of the movie has "loaded" BEFORE it actually starts playing.
I don't want someone to view a large movie that hasn't been loaded completely. If that happens it becomes choppy.
It would be like trying to run a program that hasn't been completely installed.
which could be another example...when you're installing something. you wait for the progress bar....then it says "installation complete"...then you're ready to actually run the program.
This is the same thing I'm trying to incorporate into my flash movies.

Joined: 11/28/2008
Hi DustinI understand that.

Hi Dustin

I understand that. What you do is put the bits of the movie offstage, so they are downloaded but not displayed.

The otherway is to have a loop at the start that uses the IsFrameLoaded (or something like that) function to check whether a frame is loaded, and increment the progress counter.

Paul Davey
Whitford Church
"Everyone who calls on the name of the Lord will be saved." Romans 10:13
"For all have sinned and fall short of the glory of God, and are justified

Joined: 11/28/2008
are you speaking Flash MX

are you speaking Flash MX language?
if you are....then i'm in the 101 class, and failing badly.

let's start from here...

say I make a scene. let's call it...scene1 (how clever)
now I want to add the preloader scene. let's call it...preloader (also very clever)
now, let's say I want to use 100 frames in the preloader scene.

over the course of the 100 frames, I can make a shape tween of the bar.
from here i want the bar to go from 1 to 100 depending on how much of scene1 has loaded.
now...what do I do from here.
please (if you wouldn't mind) include, steps on what to add in the action scripts, what layers to add... etc...
thanks in advance