# Alpha keeps gradually increasing

**URL:** <https://forum.kirupa.com/t/alpha-keeps-gradually-increasing/285511>\
**Category:** flash\
**Created:** [April 1, 2009, 6:49pm UTC](https://forum.kirupa.com/t/alpha-keeps-gradually-increasing/285511 "2009-04-01T18:49:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![redelite](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@redelite](https://forum.kirupa.com/u/redelite)\
**Post date:** [April 1, 2009, 6:49pm UTC](https://forum.kirupa.com/t/alpha-keeps-gradually-increasing/285511/1 "2009-04-01T18:49:10Z")

</div>

Okay, the set up. I have a MovieClip, “my\_mc”, that is hidden and shown when you MouseOver a grey block that is on the stage, similar to a tool tip. Inside of this MovieClip is a TextField, “my\_textbox”, and another MovieClip, “my\_box”. “my\_box” is underneath the textbox and will hold the graphics for the tooltip.

What I am trying to do is add a Sprite to “my\_box” and set it’s alpha to 50%, or 0.5 AS3. Well, I accomplished doing this, however, when you Mouse Out then Mouse Over again, the alpha increases by 50%, to what seems 75% alpha now, instead of staying at 50%. Do it again and it goes up another 50%, so on and so forth.

I have tried setting the “my\_box” alpha, as well as the alpha of the Sprite that is drawn inside, and it still does it. Also another piece of info, when I trace the alpha, I get 0.5, even though it appears to be solid red on screen, after a few MouseOver/MouseOuts.

The source files are attached, but for those who don’t want to download, here is the AS3 code:

```auto

var square:Sprite = new Sprite();
square.alpha = 0.5;

reset();

hover_box.addEventListener(MouseEvent.MOUSE_OVER, activate);
hover_box.addEventListener(MouseEvent.MOUSE_OUT, deactivate);

function activate(e:MouseEvent) {
  my_mc.my_textbox.text = "For some reason, this box's alpha keeps increasing on each draw.";
  my_mc.my_textbox.autoSize = "left";
  my_mc.my_textbox.width = 281;
  my_mc.width = 300;
  my_mc.visible = true;
  my_mc.x = mouseX + 25;
  my_mc.y = mouseY + 5;
  
  //create the backdrop
  square.graphics.beginFill(0x990000);
  square.graphics.drawRoundRect(0, 0, my_mc.width, my_mc.my_textbox.height + 20, 10, 10);
  square.graphics.endFill();
  my_mc.my_box.addChild(square);
  
  stage.addEventListener(MouseEvent.MOUSE_MOVE, follow);
}

function follow(e:MouseEvent) {
  my_mc.x = mouseX + 25;
  my_mc.y = mouseY + 5;
}

function deactivate(e:MouseEvent) {
  stage.removeEventListener(MouseEvent.MOUSE_MOVE, follow);
  my_mc.my_box.removeChild(square);
  reset();
}

function reset() {
  my_mc.my_textbox.text = "";
  my_mc.visible = false;
}

```

Any help would be appreciated, Thanks! 🍺
