Click to See Complete Forum and Search --> : Flash loading bar not displaying


freefall
06-10-2005, 01:51 PM
I have a simple loader bar for a flash video, but instead of loading the frame for the load bar, the entire video remains white until it has loaded completely.

Am I missing a step? I'm using MX 2004 Pro.


loadPercent = getBytesLoaded() / getBytesTotal();
loadBar._width = 63 * (loadPercent);
kbLoaded.text = Math.floor(getBytesLoaded() / 1024) + "/" + Math.floor(getBytesTotal() / 1024) + " kb";

if (loadPercent > .5) {
gotoAndPlay(3);
}


Frame 2 is just gotoAndPlay(1);

Thanks,
Ian

Frets
06-10-2005, 01:59 PM
are you sure this is correct?


loadPercent > .5)

that would make it only if 005% of the movie is loaded not more not less
as well with if statements one uses => not >

webdevelopers sister site http://flashkit.com/forums
may be better posed to answer your question.

Frets
06-10-2005, 02:04 PM
just noticed something else I hope your not copying from as

{} not ()
if {loadPercent => 5} {
gotoAndPlay(3);
}

freefall
06-10-2005, 02:23 PM
{} not ()
if {loadPercent => 5} {
gotoAndPlay(3);
}

That makes no sense, I have no clue what you're saying, it's coded just how I copied it.

Also
that would make it only if 005% of the movie is loaded not more not less
as well with if statements one uses => not >

is not true... .5 is half the video... getBytesLoaded() / getBytesTotal(), it's a ratio.


Anyway the important thing is that it isn't loading and displaying the first frame first, how Flash normally does, it is waiting for the entire thing to load before starting.

Frets
06-10-2005, 03:02 PM
How can you confirm that the entire movie has loaded?

What you may want to do is shift your frame actions one frame
as actions are loaded before visual content in the sequence of each frame.

freefall
06-10-2005, 04:07 PM
Okay I'll try it

BeachSide
06-10-2005, 05:35 PM
if statements do not use => it would be >=

Also is the movie that big that you need to only load half of it before continuing? Doesn't matter. Here is what I like to use...


// This is frame1
_root.stop();
PercentLoaded = _root.getBytesLoaded() / _root.getBytesTotal() * 100;
if (PercentLoaded != 100) {
setProperty(bar, _xscale, PercentLoaded);
} else {
gotoAndStop("loaded");
}

// This is frame2
gotoAndPlay(1);

freefall
06-10-2005, 06:40 PM
Yeah, it's very large... two video files actually create the logic for separating the loading in the middle. Since the second video will load while the first is playing, there is another duplicate loading frame set just in case it hasn't all loaded by the time the first is over. The loading frame also provides a link to a smaller dialup video.

Alright so your code is the exact same as mine except _root.stop() freezes the entire video thereby eliminating the need for a second frame because nothing would ever happen, it would only evaluate the percent loaded and if statement once.

Anyways... it really honestly true blue doesn't have anything to do with the code.

Maybe layer order has something to do with it.

freefall
06-10-2005, 06:56 PM
When I tried it, the _lite version showed the loading bar but the other does not