Creating a masked password TextInput control in Flash using ActionScript 3.0

by Peter deHaan on December 22, 2008

in TextInput

The following example shows ho wyou can create a password Flash ActionScript 3.0 TextInput component by setting the displayAsPassword 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 = "displayAsPassword";
checkBox.addEventListener(Event.CHANGE, checkBox_change);
checkBox.width = 200;
checkBox.move(10, 10);
addChild(checkBox);
 
var textInput:TextInput = new TextInput();
textInput.text = new Date().toString();
textInput.displayAsPassword = checkBox.selected;
textInput.width = 200;
textInput.move(10, 40);
addChild(textInput);
 
function checkBox_change(evt:Event):void {
    textInput.displayAsPassword = 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: