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:
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!