# Code woes

**URL:** https://forum.kirupa.com/t/code-woes/35161
**Category:** Uncategorized
**Created:** [November 11, 2003, 3:09am UTC](https://forum.kirupa.com/t/code-woes/35161 "2003-11-11T03:09:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jimw00d](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jimw00d](https://forum.kirupa.com/u/jimw00d)
#### Post date: [November 11, 2003, 3:09am UTC](https://forum.kirupa.com/t/code-woes/35161/1 "2003-11-11T03:09:11Z")

</div>

I am trying to use the preloader component (components set 2) within flash mx. The code I have so far is:

The preloader has the instance pre\_load\_pic1.

\_root.pre\_load\_pic1.setLoadTarget(“pic1.jpg”);

\_root.pre\_load\_pic1.setChangeHandler(load\_pic1);

\_root.hit2.onPress = function() {  
myInterval = setInterval(load\_pic1, 100);  
};

function load\_pic1() {  
if (pre\_load\_pic1.getPercentComplete()\>=99) {  
loadMovie(“pic1.jpg”, \_root.holder);  
clearInterval(myInterval);  
}  
}

Unfortunately the preload bar does nowt even though the jpeg does load into the browser.

Can anyone help out?

---

<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: [November 11, 2003, 10:47am UTC](https://forum.kirupa.com/t/code-woes/35161/2 "2003-11-11T10:47:36Z")

</div>

what is getPercentComplete() ?? I don’t think there is such syntax :-\

---

<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: [November 11, 2003, 10:48am UTC](https://forum.kirupa.com/t/code-woes/35161/3 "2003-11-11T10:48:05Z")

</div>

setChangeHandler takes a string as a parameter. Try

```auto
_root.pre_load_pic1.setChangeHandler("load_pic1");

```

pom 🙂

---

<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: [November 11, 2003, 10:49am UTC](https://forum.kirupa.com/t/code-woes/35161/4 "2003-11-11T10:49:17Z")

</div>

> \*Originally posted by blah-de-blah \*  
> \*\*what is getPercentComplete() ?? I don’t think there is such syntax :-\ \*\*  
> It’s probably a member function of that particular loader class 🙂
