import mx.controls.Alert;
import mx.controls.Button;
this.createClassObject(mx.controls.Button, "my_btn", 1, {label:"Play"});
my_btn.setSize(100, 25);
my_btn.move(180, 170);
var myListener:Object = new Object();
myListener.click = function() {
var myObj:Object = new Object();
myObj.click = function(evt_obj:Object) {
if (evt_obj.detail == Alert.OK) {
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Arial";
my_fmt.size = 20;
my_fmt.color = 0xFF0000;
_root.createTextField("my_txt", 10, 80, 80, 200, 40);
my_txt.setNewTextFormat(my_fmt);
my_txt.text = "你开心,我快乐!";
} else {
_root.createTextField("my_txt", 10, 100, 100, 200, 20);
my_txt.text = "让我分担你的忧愁好吗?";
}
};
Alert.buttonWidth = 100;
Alert.okLabel = "我笑了!:)";
Alert.noLabel = "今天我没有笑:(";
Alert.show("今天你笑了吗?", "请回答", Alert.OK | Alert.NO, null, myObj);
};
my_btn.addEventListener("click", myListener);
import mx.controls.Button;
this.createClassObject(mx.controls.Button, "my_btn", 1, {label:"Play"});
my_btn.setSize(100, 25);
my_btn.move(180, 170);
var myListener:Object = new Object();
myListener.click = function() {
var myObj:Object = new Object();
myObj.click = function(evt_obj:Object) {
if (evt_obj.detail == Alert.OK) {
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Arial";
my_fmt.size = 20;
my_fmt.color = 0xFF0000;
_root.createTextField("my_txt", 10, 80, 80, 200, 40);
my_txt.setNewTextFormat(my_fmt);
my_txt.text = "你开心,我快乐!";
} else {
_root.createTextField("my_txt", 10, 100, 100, 200, 20);
my_txt.text = "让我分担你的忧愁好吗?";
}
};
Alert.buttonWidth = 100;
Alert.okLabel = "我笑了!:)";
Alert.noLabel = "今天我没有笑:(";
Alert.show("今天你笑了吗?", "请回答", Alert.OK | Alert.NO, null, myObj);
};
my_btn.addEventListener("click", myListener);