// add event listeners to listen for button events [mouse over, mouse out, mouse up]
// and then - when one happens - trigger the function called 'buttonstuff'
this.stupidbutton.addEventListener(MouseEvent.MOUSE_OVER, buttonstuff);
this.stupidbutton.addEventListener(MouseEvent.MOUSE_OUT, buttonstuff);
this.stupidbutton.addEventListener(MouseEvent.MOUSE_UP, buttonstuff);
// end event listeners
// buttonstuff function - triggered by the above listeners
function buttonstuff(event:MouseEvent):void
{
// switch to 'switch' what the function does, depending
//on which mouse event the button listener has picked up.
//think of it as standing for "in case of this - do this"
switch(event.type)
{
// in 'case' the listener detected a mouse over
case MouseEvent.MOUSE_OVER:
// replace the trace with your own button actions
trace("button rolled over");
// each case always ends with a 'break'
break;
// end in 'case' the listener detected a mouse over
// in 'case' the listener detected a mouse out
case MouseEvent.MOUSE_OUT:
// replace the trace with your own button actions
trace("button rolled off");
// each case always ends with a 'break'
break;
// end in 'case' the listener detected a mouse out
// in 'case' the listener detected a mouse up
case MouseEvent.MOUSE_UP:
// replace the trace with your own button actions
trace("button released");
// each case always ends with a 'break'
break;
// end in 'case' the listener detected a mouse up
}
// end switch to 'switch' what the function does, depending on
//which mouse event the button listener has picked up
}
// end buttonstuff function