Thursday, April 22, 2010

control which characters a user can type into a Flash ActionScript 3.0 TextInput

The following example shows how you can control which characters a user can type into a Flash ActionScript 3.0 TextInput control by setting the restrict property.

Full code after the jump.

// ActionScript 3.0
/* Requires:
* - TextInput component in Flash library
*/
import fl.controls.TextInput;

var textInput:TextInput = new TextInput();
textInput.restrict = "0-9.";
textInput.move(10, 10);
addChild(textInput);

No comments:

Post a Comment