PDA

View Full Version : Preloader



deev
September 25th, 2002, 08:34 AM
How can i make a preloader that says how many percent and how many bytes he has downloaded from the whole 'movie'
vb..


79 percent
20KB/2000kB?


POlease help me


THNX:-\

jsk
September 25th, 2002, 10:16 AM
Define 2 variables

_root.loaded=_root.getBytesLoaded()
_root.total=_root.getBytesTotal()

then

_root.percentLoaded=(loaded/total)*100

Obviously, that will only perform the calculation once so you'll need to make a loop use the following code in two subsequent frames of your preLoader

(place on first frame)
_root.loaded=_root.getBytesLoaded()
_root.total=_root.getBytesTotal()
_root.percentLoaded=(_root.loaded/_root.total)*100

(place on second frame)
if (_root.percentLoaded<100) {
gotoAndPlay(_currentFrame-1);
} else {
gotoAndPlay("start");
}

where start is the first frame of your movie


The _root means that this snippet of code will work inside a MC that isn't on the main timeline - if you're evaluating percentLoaded on the main timeline, then you can dispense with the _root.

To display the variable percentLoaded - define a dynamic text field with the varible name _root.percentLoaded

There's probably a tutorial that explains this bettter with examples - some one will post the link, I'm sure.

chris
September 26th, 2002, 05:02 AM
Hey Deev,
Take a look at this I hope it helps, its a working preloader that hopefully covers what you was asking for:bandit:

chris
September 26th, 2002, 05:04 AM
Whoops, here it is:bandit:

j0ng
September 26th, 2002, 10:09 AM
i hope no 1's asked it, but for the preloader, how do u get the like percentage baR?

" 90%
||||||||||||||||||||||||||||||||||| |" -kinda like thiss..

chris
September 26th, 2002, 10:52 AM
Hi J0ng,
Is this the sort of thing you was after:bandit:

j0ng
September 26th, 2002, 12:12 PM
yep! thx, but hahaa... its been like 15 mins n i'm still figurin it ouT :( 10x still!

chris
September 27th, 2002, 10:44 AM
Hey J0ng,
I'm not sure how far you got with the last progress bar I sent so here is a simplified version, I think you'll find this one much easier to understand:bandit:

j0ng
September 28th, 2002, 01:50 AM
thX duDe! :P such a kinD souL