I’m trying to make my own button in flash application. Here is some code:
addEventListener(MouseEvent.MOUSE_OUT, Out);
addEventListener(MouseEvent.MOUSE_OVER, Over);
...
private function Over(event:MouseEvent):void
{
addChild(overImage);
}
private function Out(event:MouseEvent):void
{
removeChild(overImage);
}
When mouse is over this button, overImage is blinking. Looks like Over and Out are calling each frame. What am I doing wrong?
If the mouse is positioned in a point where
overImagewill appear, then that child object will cause aMOUSE_OVERevent on itself and thus aMOUSE_OUTevent on its parent. The parentMOUSE_OUTwill remove theoverImagefrom the display list and that wil cause again aMOUSE_OVERover the parent, startin the loop once again and making theoverImageto blink.