# onEnterFrame doesn't work for a clip loaded with loadMovie

**URL:** https://forum.kirupa.com/t/onenterframe-doesnt-work-for-a-clip-loaded-with-loadmovie/118825
**Category:** Uncategorized
**Created:** [August 9, 2004, 2:14pm UTC](https://forum.kirupa.com/t/onenterframe-doesnt-work-for-a-clip-loaded-with-loadmovie/118825 "2004-08-09T14:14:47Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![marc0047](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@marc0047](https://forum.kirupa.com/u/marc0047)
#### Post date: [August 9, 2004, 2:14pm UTC](https://forum.kirupa.com/t/onenterframe-doesnt-work-for-a-clip-loaded-with-loadmovie/118825/1 "2004-08-09T14:14:47Z")

</div>

I haven’t been able to find documentation on why loaded movies via  
‘loadMovie’ into another movie clip don’t seem to obey onEnterFrame  
commands. The following code represents a movie clip, ‘container’,  
which has a loaded external .swf file, ‘box.swf’.

I have set the container to begin a decreasing alpha change. I’ve also  
added a trace to see if the onEnterFrame is performing at all. What  
happens is that the box does not appear to have an alpha change. There  
is, however, a trace that returns an output of ‘100’ only. But no  
other numbers, suggesting that the command has stopped.

// Start

container.loadMovie(“box.swf”);  
container.onEnterFrame = function () {  
trace(container.\_alpha);  
container.\_alpha -= 1;  
}

// End

---

<div class="post-metadata">

### Author: ![claudio](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@claudio](https://forum.kirupa.com/u/claudio)
#### Post date: [August 9, 2004, 3:02pm UTC](https://forum.kirupa.com/t/onenterframe-doesnt-work-for-a-clip-loaded-with-loadmovie/118825/2 "2004-08-09T15:02:21Z")

</div>

You have to assign the _onEnterFrame_ after the movie is fully loaded.

---

<div class="post-metadata">

### Author: ![RvGaTe](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rvgate/32/126_2.png) [@RvGaTe](https://forum.kirupa.com/u/RvGaTe)
#### Post date: [August 9, 2004, 3:03pm UTC](https://forum.kirupa.com/t/onenterframe-doesnt-work-for-a-clip-loaded-with-loadmovie/118825/3 "2004-08-09T15:03:38Z")

</div>

make sure it has been loaded 🙂

flash can never load a clip in 1 line of code, it needs like, 10 lines to load up…

just use:

```auto

container.onLoad = function(){
container.onEnterFrame = function () {
trace(container._alpha);
container._alpha -= 1;
}
}

```

so it will assign the code when it has been loaded…

should work

---

<div class="post-metadata">

### Author: ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)
#### Post date: [August 9, 2004, 3:30pm UTC](https://forum.kirupa.com/t/onenterframe-doesnt-work-for-a-clip-loaded-with-loadmovie/118825/4 "2004-08-09T15:30:16Z")

</div>

well “lines” is not how you should think about it 😉 its more a matter of “time”. All lines of code that are to be run are basically run in one instance of time (though still maintaining order). A loaded movie cannot load and be accessible in that single instant.

---

<div class="post-metadata">

### Author: ![RvGaTe](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rvgate/32/126_2.png) [@RvGaTe](https://forum.kirupa.com/u/RvGaTe)
#### Post date: [August 9, 2004, 3:53pm UTC](https://forum.kirupa.com/t/onenterframe-doesnt-work-for-a-clip-loaded-with-loadmovie/118825/5 "2004-08-09T15:53:45Z")

</div>

lines of code that are to be run are basically run in one instance of time

not really true…

when executing a set of lines, it DOES goes in a few 0.00001 second or so 😛  
this problem can also be fixed when you just give it a few extra lines… or assign it onLoad…

i think of it as lines, it can be both, just like you prefer…

---

<div class="post-metadata">

### Author: ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)
#### Post date: [August 9, 2004, 4:15pm UTC](https://forum.kirupa.com/t/onenterframe-doesnt-work-for-a-clip-loaded-with-loadmovie/118825/6 "2004-08-09T16:15:32Z")

</div>

hense “basically” 😉

---

<div class="post-metadata">

### Author: ![RvGaTe](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rvgate/32/126_2.png) [@RvGaTe](https://forum.kirupa.com/u/RvGaTe)
#### Post date: [August 9, 2004, 4:48pm UTC](https://forum.kirupa.com/t/onenterframe-doesnt-work-for-a-clip-loaded-with-loadmovie/118825/7 "2004-08-09T16:48:52Z")

</div>

hmm, whatever, atleast its working now i guess 😛
