Bytes loaded

Hi,

I have a part in my site with a hudge amount kb’s so I don’t want to load it all in one part, is use this code. How can I change it to “bytes_total” to a framenumber.

bytes_loaded = Math.round(_root.getBytesLoaded()/1000);
bytes_total = Math.round(_root.getBytesTotal()/1000);
_root.loadBar._width = bytes_loaded/bytes_total*405;
if (bytes_loaded == bytes_total) {
gotoAndPlay(14);
delete bytes_loaded;
delete bytes_total;
}

Thanx

not sure if this will work but try changingthis line

if (bytes_loaded == bytes_total) {

to read this

if (bytes_loaded == bytes_total/2) {

I’m assuming that flash will start laying the animation once it reaches 50% rather than the whole 100 hence the dividing by 2

from the Actionscript Dictionary:

ifFrameLoaded

Availability

Flash Player 3. The ifFrameLoaded action is deprecated in Flash 5; use of the MovieClip._framesloaded action is encouraged.

Usage


ifFrameLoaded(scene, frame) {
	statement;
}
ifFrameLoaded(frame) {
	statement;
}

Parameters

scene The scene that must be loaded.

frame The frame number or frame label that must be loaded before the next statement is executed.

statement(s) The instructions to execute if the specified scene, or scene and frame, are loaded.

Returns

Nothing.

Description

Action; checks whether the contents of a specific frame are available locally. Use ifFrameLoaded to start playing a simple animation while the rest of the movie downloads to the local computer. The difference between using _framesloaded and ifFrameLoaded is that _framesloaded allows you to add your own if or else statements.

from the Actionscript Dictionary:

MovieClip._framesloaded

Availability

Flash Player 4.

Usage

myMovieClip._framesloadedDescription

Property (read-only); the number of frames that have been loaded from a streaming movie. This property is useful for determining whether the contents of a specific frame, and all the frames before it, have loaded and are available locally in the browser. This property is useful for monitoring the download process of large movies. For example, you might want to display a message to users indicating that the movie is loading until a specified frame in the movie has finished loading.

Example

The following example uses the _framesloaded property to start a movie when all the frames are loaded. If all the frames aren’t loaded, the _xscale property of the movie clip instance loader is increased proportionally to create a progress bar.

if (_framesloaded >= _totalframes) {
gotoAndPlay (“Scene 1”, “start”);
} else {
_root.loader._xscale = (_framesloaded/_totalframes)*100);
}

lol … i knew i forgot something!! :sigh:

that’s it LATO
all the info you may need …

the "Flash Player 3. The ifFrameLoaded action is deprecated in Flash 5; use of the MovieClip._framesloaded action is encouraged. " in your post tipped me off :slight_smile:

yeah … i have the as dictionary in the page
i forgot to paste it in my post :cyclops:

[size=1]**PS: **go team!! lol :P[/size]

Thanx, but I don’t need to load all the frames/all the bytes… Only all the bytes untill frame 60 for example.

As you can see, I did this with a loadBar

bytes_loaded = Math.round(_root.getBytesLoaded()/1000);
bytes_total = Math.round(_root.getBytesTotal()/1000);
_root.loadBar._width = bytes_loaded/bytes_total*405;
if (bytes_loaded == bytes_total) {
gotoAndPlay(14);
delete bytes_loaded;
delete bytes_total;
}

Maby you know this but I don’t really understand what you mean :s

did you try changing that one line like i told you to?

That makes 50%, I need a framenumber…


if (_framesloaded >= 60) {
	gotoAndPlay (3)
} else {
	gotoAndPlay (1)
}

the script should be at the second frame