You need to determine when the user interacts with a button.
Listen for events broadcast by the button.
function onButtonRelease():Void
{
trace("button was clicked");
}
function onButtonRollOver():Void
{
trace("button was moused over");
}
my_button.onRelease = onButtonRelease;
my_button.onRollOver = onButtonRollOver;
function onButtonClick(event:MouseEvent):void
{
trace("button was clicked");
}
function onMouseOver(event:MouseEvent):void
{
trace("button was moused over");
}
my_button.addEventListener(MouseEvent.CLICK, onButtonClick);
my_button.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
Note: Both examples assume there is a button symbol instance named "my_button" on the same timeline as the code.