The following example shows how you can enable or disable a Flash ActionScript 3.0 TextInput control by setting the Boolean enabled property.
Full code after the jump.
// ActionScript 3.0
/* Requires:
* - CheckBox component in Flash library
* - TextInput component in Flash library
*/
import fl.controls.CheckBox;
import fl.controls.TextInput;
var checkBox:CheckBox = new CheckBox();
checkBox.label = "enabled";
checkBox.selected = true;
checkBox.addEventListener(Event.CHANGE, checkBox_change);
checkBox.move(10, 10);
addChild(checkBox);
var textInput:TextInput = new TextInput();
textInput.text = new Date().toString();
textInput.enabled = checkBox.selected;
textInput.width = 300;
textInput.move(10, 40);
addChild(textInput);
function checkBox_change(evt:Event):void {
textInput.enabled = checkBox.selected;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment