# "Invisiblity device" on movieclips

**URL:** <https://forum.kirupa.com/t/invisiblity-device-on-movieclips/230600>\
**Category:** flash\
**Created:** [June 27, 2007, 4:14pm UTC](https://forum.kirupa.com/t/invisiblity-device-on-movieclips/230600 "2007-06-27T16:14:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fw2803](https://avatars.discourse-cdn.com/v4/letter/f/e5b9ba/32.png) [@fw2803](https://forum.kirupa.com/u/fw2803)\
**Post date:** [June 27, 2007, 4:14pm UTC](https://forum.kirupa.com/t/invisiblity-device-on-movieclips/230600/1 "2007-06-27T16:14:10Z")

</div>

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?

```auto

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?
