hello peeps,
ok, i have a movie clip with an onEnterFrame event that basically just checks a value. if the value is true, i want to clip event to fire a function, then clear itself (i dont want a movieclip endlessly checking the value in the enterFrame because it can slow the main movie down.) i thought i could do this with delete this.onEnterFrame.
heres an example i’m trying it with…
onClipEvent(enterFrame){
i ++
trace(i)
if (i >= 5){
delete this.onEnterFrame
}
}
so when i >= 5, it should stop tracing, and basically end.
onClipEvent(enterFrame) and onEnterFrame are not the same thing. The both do the same thing, but are not themselves the same thing. If you want to delete that action thats happening there, you can either 1) not use an onClipEvent(enterFrame) and instead use an onClipEvent(load) and set the this.onEnterFrame to equal a function with that script
onClipEvent(load){
this.onEnterFrame = function(){
i ++
trace(i)
if (i >= 5){
delete this.onEnterFrame
}
}
}
or 2) basically do the same thing, but not in the load, rather assign the onEnterframe function within a frame in the timeline.