import flash.events.MouseEvent;
/* Create an instance of a TextField */
var Message:TextField = new TextField();
/* Set text and coordinates */
Message.text = "Before";
Message.x=100;
Message.y=50;
/* Make your textfield visible */
addChild(Message);
/* Create your button */
var Button:MovieClip = new MovieClip();
Button.graphics.beginFill(0xFF0000);
Button.graphics.drawRect( 100, 100 ,150,50);
Button.graphics.endFill();
/* Make your button visible */
addChild(Button);
/* Link the button to ChangeText function */
Button.addEventListener(MouseEvent.CLICK, ChangeText);
/* Create the ChangeText function in order to receive a MouseEvent */
function ChangeText (evt:MouseEvent) {
/* Set new text */
Message.text="After";
}
Nessun commento:
Posta un commento