# Preload in 25% sections?

**URL:** <https://forum.kirupa.com/t/preload-in-25-sections/61965>\
**Category:** flash\
**Created:** [August 23, 2004, 7:30pm UTC](https://forum.kirupa.com/t/preload-in-25-sections/61965 "2004-08-23T19:30:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![malidia](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/malidia/32/684_2.png) [@malidia](https://forum.kirupa.com/u/malidia)\
**Post date:** [August 23, 2004, 7:30pm UTC](https://forum.kirupa.com/t/preload-in-25-sections/61965/1 "2004-08-23T19:30:34Z")

</div>

Okay, i am trying to make a preloaded that stops on frames depending on how much is loaded, i want it to stay on frame 1 if 24% or less of the movies is loaded and for every 25% i want it to it to move forward a frame,

so far i have done thus,

var bytes = \_root.getBytesTotal();  
var bytes\_loaded = \_root.getBytesLoaded();  
if (bytes / bytes\_loaded \>= .25) {  
\_root.gotoAndPlay(2);  
} else {  
\_root.gottoAndStop(1); }

i am not sure if this works or not for i am at work, and will not get to try it for another 6 hours, but many of my past attempts have failed and i doubt this one will work, can anybody help me modify this code to do what i need, thanks a million! kiss, kiss

---

<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 23, 2004, 11:34pm UTC](https://forum.kirupa.com/t/preload-in-25-sections/61965/2 "2004-08-23T23:34:54Z")

</div>

```auto
var bytes = _root.getBytesTotal();
var bytes_loaded = _root.getBytesLoaded();
if ((bytes_loaded / bytes) >= .25) {
_root.play();
}

```

should work for the first frame… ifu want a universal code you can have this:

```auto
var bytes = _root.getBytesTotal();
var bytes_loaded = _root.getBytesLoaded();
if(Tperfcent==undefined){
Tpercent = .25
}
if ((bytes_loaded / bytes) >= Tpercent) {
Tpercent += .25
_root.play();
}

```

but if i were u id just edit the first code slightly for each frame you are on…

by the way, just in case, those values will only update each time the frame is loaded… so if you have it on a single frame with a stop() action on it, not a lot is gonna happen 😉

Prophet.

---

<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 25, 2004, 2:21am UTC](https://forum.kirupa.com/t/preload-in-25-sections/61965/3 "2004-08-25T02:21:40Z")

</div>

thank you so much, that makes sense, i am just getting hang of action script, and it seems dumb i even asked the question now, but i guess that’s the nature of learning.

---

<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 25, 2004, 6:02pm UTC](https://forum.kirupa.com/t/preload-in-25-sections/61965/4 "2004-08-25T18:02:53Z")

</div>

hey no probs mate,

it was a pleasure 🙂

Prophet.

---

<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 25, 2004, 9:06pm UTC](https://forum.kirupa.com/t/preload-in-25-sections/61965/5 "2004-08-25T21:06:13Z")

</div>

I`m sure Prophets way is fine but i have just made this for someone else;  
thought you may want to look.  
You have to goto view/streaming to see

---

<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 25, 2004, 9:46pm UTC](https://forum.kirupa.com/t/preload-in-25-sections/61965/6 "2004-08-25T21:46:20Z")

</div>

stringy what if you want to add a preloading bar or percentage completion for each swf.

---

<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 25, 2004, 10:11pm UTC](https://forum.kirupa.com/t/preload-in-25-sections/61965/7 "2004-08-25T22:11:55Z")

</div>

> [@Gupps](#):
>
> stringy what if you want to add a preloading bar or percentage completion for each swf.

have a look at the other thread.
