# Bytes loaded

**URL:** <https://forum.kirupa.com/t/bytes-loaded/10952>\
**Category:** flash\
**Created:** [January 9, 2003, 7:33pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952 "2003-01-09T19:33:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![LATO](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@LATO](https://forum.kirupa.com/u/LATO)\
**Post date:** [January 9, 2003, 7:33pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/1 "2003-01-09T19:33:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 7:47pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/2 "2003-01-09T19:47:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 7:49pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/3 "2003-01-09T19:49:49Z")

</div>

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

```auto

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 7:56pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/4 "2003-01-09T19:56:19Z")

</div>

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);  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 8:00pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/5 "2003-01-09T20:00:10Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 8:03pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/6 "2003-01-09T20:03:46Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 8:08pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/7 "2003-01-09T20:08:37Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 8:43pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/8 "2003-01-09T20:43:59Z")

</div>

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;  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 8:45pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/9 "2003-01-09T20:45:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 8:52pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/10 "2003-01-09T20:52:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 9:13pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/11 "2003-01-09T21:13:00Z")

</div>

That makes 50%, I need a framenumber…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 9, 2003, 9:29pm UTC](https://forum.kirupa.com/t/bytes-loaded/10952/12 "2003-01-09T21:29:27Z")

</div>

```auto

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

```

the script should be at the second frame
