The plan was very simple: Using MouseEvent.CLICK to hide/show a Sprite. The first click should make it disappear, the second make it visible again.
What actually happened was really odd, as the Sprite didn't become visible when alpha was set to 1 (unless I zoom in or open the Settings menu). Here's an example: http://www.fastswf.com/8BuuY14
private function doStuff(e:MouseEvent):void {
(e.target.alpha == 1) ? e.target.alpha = 0 : e.target.alpha = 1;
}
//Sprite on the left
var outter:Sprite = new Sprite(); //Container sprite (gray background)
outter.x = outter.y = 20;
outter.opaqueBackground = 0xCCCCCC;
outter.addEventListener(MouseEvent.CLICK, doStuff);
var inner:Sprite = new Sprite(); //Interactive child (red square)
inner.graphics.beginFill(0xFF0000);
inner.graphics.drawRect(0, 0, 50, 50);
var speck:Shape = new Shape(); //Reference child (tiny black square)
speck.graphics.beginFill(0x000000);
speck.graphics.drawRect(50, 50, 5, 5);
outter.addChild(inner);
outter.addChild(speck);
addChild(outter);
//Sprite on the right
var cont:Sprite = new Sprite();
cont.x = 100; cont.y = 20;
cont.graphics.beginFill(0xFF0000);
cont.graphics.drawRect(0, 0, 50, 50);
cont.addEventListener(MouseEvent.CLICK, doStuff);
addChild(cont);
I did manage to make it work, by using alpha values equal to or larger than 0.0078125 (in true alpha value), but not 0. Why is this happening?
[EDIT]
Since I established the error could be caused by my IDE, I requested help also at the FlashDevelop community (see comments for link).