An .onEnterFrame Question (AS MX)

A simple topic i’m breaking my head about…

I’m creating a complex site, with lots of calculations, while I have to keep it as light as possible. I don’t want to have 50 [color=slategray].onEnterFrame[/color][color=black]'s[/color] running simultaniously, so, how do I stop them? See example:

Let’s say I want a simple movement, invoked by some reason:

 
 
mcChild.onEnterFrame = function(){
if(mcChild._x < mcParent._width){
mcChild._x += 5;
}
}

Now I want to stop the [color=slategray].onEnterFrame[/color] check, because it reached the [color=slategray]if = false[/color][color=black] - How??[/color]

Cheers

delete this.onEnterFrame;

:stuck_out_tongue:

MWOAHAHAHAHAHAHA - Oh Dear, oh dear. The Simplicity, the stupidity…

I want those crazy pills of yours…

Cheers mate.

lol, no worries. My first reaction was similar - “you can DO that?!?!” :lol:

We all go through it yo :hr:

you can also do this:

_root.onEnterFrame = null;

If you wanted to run a function as an onEnterFrame without using onEnterFrame within the function itself you could do this:

_root.onEnterFrame = myFunction ();