How to disable a HIT area in AS2?

261 views Asked by At

How to disable a HIT area (a movieClip with instance name "HIT") in AS2?

Please note that I don't want to hide the hit area after it get hitted. Just needed a code that disable it or remove its instance name so that other objects cannot hit it again.

2

There are 2 answers

0
akmozo On

You can just do :

your_mc.hitArea = null

Or

your_mc.hitArea = undefined
3
helloflash On

If you want an instance c1 to be disabled after being touched, you can do:

c1.onEnterFrame = function():Void {
    if (this.hitTest(anotherMovieClip)) {
        delete this.onEnterFrame;
    }
}

The hitTest can't occur after the onEnterFrame function is deleted.