Flash & ActionScript3: use TextField as button

Trabla: Flash & ActionScript3 - use TextField as button

Solving:

import flash.text.TextField;

...

var btnGo:TextField = new TextField();
btnGo.htmlText = "<a href='event:null'>Go!</a>";
btnGo.width = 50;
btnGo.height = 50;
btnGo.x = 10;
btnGo.y = 10;
btnGo.border = true;
btnGo.selectable = false;
btnGo.addEventListener( MouseEvent.CLICK, btnGoClicked );

...

public function btnGoClicked (e:MouseEvent):void{
            trace('Button Go Clicked');     
}



No comments:

Post a Comment