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; }
{ 6 comments… read them below or add one }
May I ask you a question?
besides Flex components & TextLayout Components & fl Components
If any component can support “keyboard input”?
Like flash.text.TextField;
If no , how “adobe text layout frame” create a TextInput ?
Thanks a lot^^;
purplewind,
The flash.text.TextField supports text input, you just need to set the
typeproperty to “input” (or use the static TextFieldType.INPUT constant).Flash Player 10 also added the Text Layout Framework (TLF) classes, as well as the native Flash Text Engine (FTE) classes. For more information, check out the beta Flex Gumbo docs at http://livedocs.adobe.com/flex/gumbo/langref/
Peter
Thank you, Peter^^
I knew TextField can support Input.
But in the environment of Flash Player 10,
I’m using the FTE , so I need an original Input component that will not increase swf’s size.
Of course I could use the TextField class simply
But I have something that baffles.
If there is no other original Input componet.
How TLF support textinput ?
TLF used a TextField for its input action ?
I have read all FTE classe scarefully. .
But I haven’t found a class like that .
Sorry, the Text Layout Framework (TLF) was an add-on, not actually shipped WITH Flash Player 10 (my first email was a bit vague).
For more information on the TLF project, check out the TLF page on the Adobe Labs site http://labs.adobe.com/technologies/textlayout/ and the TLF team’s blog at http://blogs.adobe.com/tlf/.
As far as I know (and I could be wrong) TLF is built on top of FTE, so it uses the FTE classes and adds its own additional functionality.
Peter
Yestday I read some about IME
I think a input component may used it .
TLF built on top of FTE , yes.
But I afraid that TLF components & Flex components will let
a swf file with more then “400Kb”.
So , if could develop a lightweight text frame with FTE , then I can control my
swf file size in “20Kb”.
Thank you for your help.^^