"Invisiblity device" on movieclips

Hello there
I’m trying to make a movieclip invisible when I press “s” (with keycode 83). When I press “s” again, I want it visible again. Alogarithm:

START
IF VISIBLE AND KEYPRESS S
ALPHA = 0
IF INVISIBLE AND KEYPRESS S
ALPHA = 100
END

(I have to use _alpha as I need the intermediate of it later.)

What codes should I use in AS2?

Like this?


onClipEvent (load) {
  var invis:Boolean = false
}
onClipEvent (enterFrame) {
  if ((invis==false) && (Key.isDown (83))) {
    this._alpha = 0
    invis = true
  }
  if ((invis==true) && (Key.isDown (83))) {
    this._alpha = 100
    invis = false
  }
}

But my codes just don’t work. Is there something wrong about them?