Return to Kroll Design home page

Flash Tutorials (with .FLA files included)

 
« Return

ActionScript 3

SimpleButton objects

You can create a button using the SimpleButton class, passing the constructor 4 movie clips, one clip for each of the states: up, over, down and hit.

Download the FLA file

var myText_txt:TextField = new TextField;
myText_txt.autoSize = TextFieldAutoSize.LEFT;
myText_txt.text = "(feel free to click the button)";
myText_txt.x = 180;
myText_txt.y = 90;
addChild(myText_txt);
var myButton_btn:SimpleButton = new SimpleButton(new MyButtonUp(), new MyButtonOver(), new MyButtonDown(), new MyButtonHit());
myButton_btn.x = 100;
myButton_btn.y = 100;
addChild(myButton_btn);
myButton_btn.addEventListener(MouseEvent.CLICK, buttonClick);
function buttonClick(myEvent:MouseEvent)
{	
	myText_txt.text = "button was clicked";	
}


 
« Return


©2012 Kroll Design    info@KrollDesign.net    781.910.3694
Last modified: 12/31/1969 7:00 PM