# MX - Delay Problem with AS

**URL:** https://forum.kirupa.com/t/mx-delay-problem-with-as/22118
**Category:** Uncategorized
**Created:** [May 30, 2003, 1:19pm UTC](https://forum.kirupa.com/t/mx-delay-problem-with-as/22118 "2003-05-30T13:19:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![BVision](https://avatars.discourse-cdn.com/v4/letter/b/e56c9b/32.png) [@BVision](https://forum.kirupa.com/u/BVision)
#### Post date: [May 30, 2003, 1:19pm UTC](https://forum.kirupa.com/t/mx-delay-problem-with-as/22118/1 "2003-05-30T13:19:50Z")

</div>

This code is on fame one of my buttons mc…

When I click on the first and then the second button everything is great.

As soon as I stop clicking… let’s say… 5-10 seconds of non-clicking time… there is a dramatic delay when displaying a graphic…

Why is this?  
I dont understand why this is happening… after the images are loaded, they should just pull right up again… (My thoughts…)

Pleas help.

The code is…

[AS]

but.onPress = function() {  
\_root.createEmptyMovieClip(“container”, 1);  
\_root.container.loadMovie(“images/full/Fogged Eye v1.jpg”);  
\_root.container.\_alpha = 0;  
\_root.container.\_x = 290;  
\_root.container.\_y = 10;  
accel = \_root.container.\_alpha+8;  
onEnterFrame = function () {  
\_root.container.\_alpha += accel;  
\_root.container1.\_alpha -= accel;  
};  
};

but2.onPress = function() {  
\_root.createEmptyMovieClip(“container1”, 2);  
\_root.container1.loadMovie(“images/full/Precious Lightning v1.jpg”);  
\_root.container1.\_x = 290;  
\_root.container1.\_y = 10;  
\_root.container1.\_alpha = 0;  
accel = \_root.container1.\_alpha+8;  
onEnterFrame = function () {  
\_root.container1.\_alpha += accel;  
\_root.container.\_alpha -= accel;  
};  
};

[/AS]

---

<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: [May 30, 2003, 3:48pm UTC](https://forum.kirupa.com/t/mx-delay-problem-with-as/22118/2 "2003-05-30T15:48:35Z")

</div>

it may be because of that onEnterFrame function. Flash probably thinks you are trying to give that button an onEnterFrame, which it can’t do. try changing your oEF function headings to

```auto
_parent.onEnterFrame = function() { ... } 

```

---

<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: [May 30, 2003, 6:27pm UTC](https://forum.kirupa.com/t/mx-delay-problem-with-as/22118/3 "2003-05-30T18:27:16Z")

</div>

I did that… No change…

Thanks for the effort though.

Im not quite sure why this code is having this delaying-- problem…

I will post more code if someone wants to try to help.

* * *

I updated the pictures being loaded… I thought it was maybe the filesize of the full pictures. But it wasnt… It’s something with the way things are loaded/AS/objects… Something isnt right…

hhmm…  
???

any thoughts?

---

<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: [May 30, 2003, 6:35pm UTC](https://forum.kirupa.com/t/mx-delay-problem-with-as/22118/4 "2003-05-30T18:35:29Z")

</div>

here’s something you may want to look up in the flash help:

```auto
setInterval

```

i would go into detail but i have to go. i’ll check back later.
