# Can I partially load?

**URL:** https://forum.kirupa.com/t/can-i-partially-load/4645
**Category:** flash
**Created:** [August 15, 2002, 5:33am UTC](https://forum.kirupa.com/t/can-i-partially-load/4645 "2002-08-15T05:33:53Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![gsdesigns](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@gsdesigns](https://forum.kirupa.com/u/gsdesigns)
#### Post date: [August 15, 2002, 5:33am UTC](https://forum.kirupa.com/t/can-i-partially-load/4645/1 "2002-08-15T05:33:53Z")

</div>

I have a 2.6mb Flash MX video. I attached a preloader to it, but now the movie won’t run until the preloader reaches 100%. Using the bytesLoaded function. Wondering is there any way to start playing the movie once say 50% has been reached. Since it is a 2.6mb file, it takes a while and I would like to run it, while the remaining 50% is loading… Possible?

---

<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: [August 15, 2002, 5:50am UTC](https://forum.kirupa.com/t/can-i-partially-load/4645/2 "2002-08-15T05:50:46Z")

</div>

## do you use

## ifFrameLoaded();

## or

## if (bytestotal-bytesloaded == 0); --or sumthiin’ like that

## so anyway change it to:

## bytespercent = (bytesloaded/bytestotal)\*100 if (bytespercent == 50) { }

You have to change the “bytestotal” and “bytesloaded” to the variables you have. also check if ya already have sumthin’ like bytespercent which has a value of percents loaded then you don’t have to add that line but you have to change “bytespercent” in the IF statement to the one that ya have…  
tip: bytestotal is defined by “\_getBytesTotal” and bytesloaded is defined by “\_getBytesLoaded” by these things it’s easier to locate the variables…

---

<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: [August 16, 2002, 2:25am UTC](https://forum.kirupa.com/t/can-i-partially-load/4645/3 "2002-08-16T02:25:25Z")

</div>

Here is what I have. It is not working correctly, will not display the percentage. Did I mess it up?

stop();  
myInterval = setInterval(preloader, 10);  
function preloader() {  
if (\_framesloaded\>=100) {  
play();  
clearInterval(myInterval);  
}  
progressBar.\_xscale = (\_framesloaded/\_totalframes)\*100;  
}  
myTextField.text=Math.round(\_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: [August 16, 2002, 6:08am UTC](https://forum.kirupa.com/t/can-i-partially-load/4645/4 "2002-08-16T06:08:39Z")

</div>

you should not place that stop(); action first. It will stop the movie from reading everything else in that frame.

secondly, you have to have a loop to continualy check on the code.

Thirdly… can you explain what that whole “interval” thing is about? I’m not sure I understand what you’re trying to accomplish with that.

PS - You should check out the speach Moock made on the subject at the Flash forward convention. It can be found at [www.moock.org](http://www.moock.org).

---

<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: [August 16, 2002, 4:11pm UTC](https://forum.kirupa.com/t/can-i-partially-load/4645/5 "2002-08-16T16:11:16Z")

</div>

david -

stop doesn’t prevent execution of the rest of the code in the frame, give it a try:

```auto

stop();
trace("i didn't stop!");

```

gsdesigns -

i’m not sure here, but i think you might need to path to all your relevant details in that function.

i would recommend swapping getBytesLoaded() and getBytesTotal() in place of \_framesloaded and \_totalframes respectively. i also note that your treating them as properties in one instance (no () at the end) and methods in another (with the ()).

try tracing that last line instead of assigning it to myTextField:

```auto

trace((_root.getBytesLoaded()/_root.getBytesTotal()*100)+"%");

```

that will give you an idea of where to start troubleshooting.

---

<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: [August 17, 2002, 5:21am UTC](https://forum.kirupa.com/t/can-i-partially-load/4645/6 "2002-08-17T05:21:40Z")

</div>

Are you sure supra?? I’ve read in a couple of books that it may or may not stop reading the rest of the code in a frame.

Though they may have been refering to code on different layers… but I’m not sure why that would make a diff.

If I’m mistaken… sorry for being misleading.

Also… since I got you here supra… why would you replace bytes for frames in the bytesLoaded statement? What would he gain by doing so except a less accurate read of the data?

---

<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: [August 19, 2002, 1:43am UTC](https://forum.kirupa.com/t/can-i-partially-load/4645/7 "2002-08-19T01:43:19Z")

</div>

> _Are you sure supra?? I’ve read in a couple of books that it may or may not stop reading the rest of the code in a frame._

did you try the example? works for me every time.

different layers might make a difference … flash can be a buggy animal sometimes.

> -

Also… since I got you here supra… why would you replace bytes for frames in the bytesLoaded statement? What would he gain by doing so except a less accurate read of the data? \*

sorry? less accurate? frames tend not to be evenly loaded byte wise, ie. some frames will contain (vastly) more data than others. that makes your load meter stall and jump as it encounters ‘heavy’ frames.

a more accurate read is precisely what you _do_ gain.
