FMX problems with moving code

suppose i have the following code on a movieclip
[AS]
onClipEvent(load){
var someVariable = 0
someFunction = function(){
//do something
}
}
onClipEvent(enterframe){
someVariable++
if(!_parent.something){
someFunction()
}
}
[/AS]

and i want to put that code INSIDE a frame of the movieclip instead of ON the movieclip, i would have to use this.onLoad = function() {blah blah} and this.onEnterFrame = function() {blah blah} and you would suppose it would work the same, but it doesnt work at all. Am i doin something wrong? i appreciate all comments/advice/etc…

maybe
[AS]
_parent.onLoad = function() {
blah blah
};
[/AS]

You are placing this inside the movieclip this was previously on, right ? Then use this code:


someVariable = 0
someFunction = function(){
//do something
}
this.onEnterFrame = function(){
        someVariable++
        if(!this._parent.something){
//you might wanna delete the onEnterFrame handler here, because it will keep executing someFunction if you don't
                someFunction()
        }
}

Should do it.