myButtons.addEventListener("mouseDown", buttonF);
myButtons.addEventListener("mouseOver", buttonF); myButtons.addEventListener("mouseOut", buttonF); function buttonF(evt:Event):void { if (evt.type == "mouseDown") { switch (evt.target.name) { case "btn1": myText.text = "Mouse down; button 1"; break; case "btn2": myText.text = "Mouse down; button 2"; break; } } else if (evt.type == "mouseOver") { myText.text = "Mouse over; "+evt.target.name; }else if (evt.type == "mouseOut") { myText.text = "Mouse out; "+evt.target.name; } } |