Creating an uneditable TextInput control in Flash using ActionScript 3.0

by Peter deHaan on December 22, 2008

in TextInput

The following example shows how you can create an uneditable Flash ActionScript 3.0 TextInput control by setting the Boolean editable 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 = "editable";
checkBox.selected = true;
checkBox.addEventListener(Event.CHANGE, checkBox_change);
checkBox.move(10, 10);
addChild(checkBox);
 
var textInput:TextInput = new TextInput();
textInput.editable = checkBox.selected;
textInput.width = 300;
textInput.move(10, 40);
addChild(textInput);
 
function checkBox_change(evt:Event):void {
    textInput.editable = checkBox.selected;
}

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Previous post:

Next post: