# Preloader/Script Error Problem

**URL:** <https://forum.kirupa.com/t/preloader-script-error-problem/28307>\
**Category:** flash\
**Created:** [August 12, 2003, 1:32pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307 "2003-08-12T13:32:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jillymo](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@jillymo](https://forum.kirupa.com/u/jillymo)\
**Post date:** [August 12, 2003, 1:32pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/1 "2003-08-12T13:32:31Z")

</div>

I have an fla that is loading 2 external swf’s (both are fairly small in size, as they are just text effects , about 16k each)  
The code is applied to 2 emptymc’s I made & placed on the stage for containers.  
(although I since learned that these could be generated with script as well)

I also have some code on my first frame that is set to randomly move some cloud images I have on the stage.

The movie was playing ok, but loading slow - there are many images and this is going to be a VERY large file I have accepted that.

So, I made a new first scene and put a preloader on it.

Now, when I control +enter to preview the movie, I get this error:  
(screen shot attached below)

A script in this movie is causing the Flash Player to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?

If I pick yes, the movie will play but no random cloud movement and no loading of the external swf’s.  
I know it would be so much easier if I could attach my fla but it is much too big.

:toad:

---

<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 12, 2003, 1:34pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/2 "2003-08-12T13:34:36Z")

</div>

Copy and paste your script along with what frames and scene it is in.

V.

---

<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 12, 2003, 1:35pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/3 "2003-08-12T13:35:01Z")

</div>

Well…there must be something wrong with your codes and stuff, and the only way we can find out is look at your fla :-\ Unless you know which part it is and can just post the code or something…

---

<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 12, 2003, 1:44pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/4 "2003-08-12T13:44:33Z")

</div>

Okay-  
Here is the first scene of the movie called preloader

First frame has code:  
\<hr\>  
bytes\_loaded = Math.round(this.getBytesLoaded());  
bytes\_total = Math.round(this.getBytesTotal());  
getPercent = bytes\_loaded/bytes\_total;  
this.loadBar.\_width = getPercent_100;  
this.loadText = Math.round(getPercent_100)+"%";  
if (bytes\_loaded == bytes\_total) {  
this.gotoAndPlay(3);  
}  
\<hr\>

Second frame has this code:  
\<hr\>  
this.gotoAndPlay(1);  
\<hr\>

And third frame of this scene has this code:  
\<hr\>  
gotoAndPlay(“scene1”,1);  
\<hr\>

Then I have a scene 1 with this code on frame 1:  
(I am using the createEmptyMovieClip command instead of the actual empty mc’s on the stage- as mentioned in my first post- and there are also 3 cloud symbols with this code directly on them:  
onClipEvent(enterFrame){  
move();  
}

\<hr\>  
function getdistance(x,x1) {  
var run;  
run = x1-x;  
return (\_root.hyp(run));  
}  
function hyp(a, b) {  
return (Math.sqrt(a_a+b_b));  
}  
MovieClip.prototype.reset = function() {  
//specify the width and height of the movie  
width = 1024;  
height = 300;  
//-------------------  
var dist, norm;  
this.x = this.\_x;  
this.speed = Math.random()\*4+1;  
this.targx = Math.random()\*width;  
dist = \_root.getdistance(this.x,this.targx);  
norm = this.speed/dist;  
this.diffx = (this.targx-this.x)\*norm;  
};  
MovieClip.prototype.move = function() {  
if (\_root.getdistance(this.x,this.targx)\>this.speed) {  
this.x += this.diffx;  
} else {  
this.x = this.targx;  
if (!this.t) {  
this.t = getTimer();  
}  
if (getTimer()-this.t\>1000) {  
this.reset();  
this.t = 0;  
}  
}  
this.\_x = this.x;  
};

this.createEmptyMovieClip(“clip1”, 1);  
clip1.loadMovie(“welcometo.swf”);  
\<hr\>

This was my second attempt to get this file to work, so I was only trying to load one external swf (welcometo.swf) instead of 2. But still same problem.

---

<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 12, 2003, 1:50pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/5 "2003-08-12T13:50:48Z")

</div>

In the scence “scene1” label the first frame. e.g “Main”.

Then in your preloader scene in the 3rd frame use the frame label name to target that frame.

I dont encourage the use of scenes, they are more trouble than they are worth in my opinion.

Regards,  
Viru.

---

<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 12, 2003, 1:55pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/6 "2003-08-12T13:55:08Z")

</div>

well you think I would be better off not using scenes at all and just dropping the preloader into the same scene as my main movie?

---

<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 12, 2003, 1:56pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/7 "2003-08-12T13:56:40Z")

</div>

Try labelling the frame first.

But thats how i do it. The first 2 frames of all my swf’s are for the preloader soley. I’ve never had a major preloader since. 🙂

Regards,  
V.

---

<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 12, 2003, 1:56pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/8 "2003-08-12T13:56:56Z")

</div>

yes…best not to use any scenes in any swf at all 🙂

---

<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 12, 2003, 1:57pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/9 "2003-08-12T13:57:40Z")

</div>

Okay-

well thank you for all the friendly advice

~Jill

:thumb:

---

<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 12, 2003, 2:00pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/10 "2003-08-12T14:00:23Z")

</div>

Your very welcome.

V.

---

<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 12, 2003, 2:16pm UTC](https://forum.kirupa.com/t/preloader-script-error-problem/28307/11 "2003-08-12T14:16:29Z")

</div>

Well I tried the frame label solution, still same error.  
I moved my preloader into the same scene as the main movie and viola-  
worked like a charm.

I will avoid scenes from now on! Thanks guys! :azn:
