# Movement Preloader?

**URL:** https://forum.kirupa.com/t/movement-preloader/64917
**Category:** flash
**Created:** [September 21, 2004, 12:37pm UTC](https://forum.kirupa.com/t/movement-preloader/64917 "2004-09-21T12:37:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ben\_is\_sparky](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ben_is_sparky/32/664_2.png) [@ben\_is\_sparky](https://forum.kirupa.com/u/ben_is_sparky)
#### Post date: [September 21, 2004, 12:37pm UTC](https://forum.kirupa.com/t/movement-preloader/64917/1 "2004-09-21T12:37:16Z")

</div>

I am trying to make a preloader where rather than have a bar which gets bigger, I want a movieClip to move across the stage. I am using the following code but it doesn’t work:

> 

stop;  
PercentLoaded = getBytesLoaded/getBytesTotal_100;  
if (PercentLoaded != 100) {  
setProperty(boat, \_x, PercentLoaded_12);  
} else {  
gotoAndPlay(“3”);  
}

Can anyone help me?

It isn’t in a seperate scene or movieclip, might this be the problem?

Thanks, Ben

---

<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: [September 21, 2004, 2:16pm UTC](https://forum.kirupa.com/t/movement-preloader/64917/2 "2004-09-21T14:16:10Z")

</div>

if your movie clip is as big as 1200 (weight) then i don’t see the problem! Else, replace the \*12 with the \*3+100 or something…Helped you?  
Or…  
you could replace the:

> setProperty(boat, \_x, PercentLoaded\*12);

with the:

> \_root.boat.\_x=PercentLoaded\*3;

or the:

> \_root.boat.\_x=PercentLoaded\*12;

It must work now!!  
Try all this…

---

<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: [September 21, 2004, 3:27pm UTC](https://forum.kirupa.com/t/movement-preloader/64917/3 "2004-09-21T15:27:01Z")

</div>

It isn’t the \*12 because I can take that out all together and it makes no difference.

Also, should it be whithin a movieclip because at the moment it isn’t, it’s just on frames 1 and 2 of the timeline (frame 2 being goToAndPlay(1)😉

I’ll have another look at it

Thanks

[edit]

I found this code on one of the tutorials here, which works but I don’t really see the difference Does anyone know?

> 

bytes\_loaded = Math.round(\_root.getBytesLoaded());  
bytes\_total = Math.round(\_root.getBytesTotal());  
getPercent = bytes\_loaded/bytes\_total;  
\_root.boat.\_x = getPercent_1200;  
\_root.box = Math.round(getPercent_100)+“%”;  
if (bytes\_loaded == bytes\_total) {  
\_root.gotoAndStop(3);  
}

Also, now it works, but it only shows the first frame of my mc. Does anyone know how to make it play as it moves across?

---

<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: [September 22, 2004, 3:04pm UTC](https://forum.kirupa.com/t/movement-preloader/64917/4 "2004-09-22T15:04:26Z")

</div>

Make only one frame, not 2 and add this to the main frame! the movieclip that will move is named ‘mc’ (without the quotas). It worked for me!!

```auto
stop();
nik=mc._x;
_root.onEnterFrame= function() {
	bytes_loaded = Math.round(_root.getBytesLoaded());
	bytes_total = Math.round(_root.getBytesTotal());
	getPercent = bytes_loaded/bytes_total*100;
	mc._x=nik+getPercent*2; //instead of *2 you can add *12 or whatever you want
	if (bytes_loaded == bytes_total) {
		//do when movie is loaded
	}
}

```

Your code was missing the “\_root.onEnterFrame= function() {”
