Disabling a TextInput component in Flash using ActionScript 3.0

by Peter deHaan on December 22, 2008

in TextInput

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 }

1 purplewind 02.27.09 at 1:14 am

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^^;

2 Peter deHaan 02.27.09 at 2:16 am

purplewind,

The flash.text.TextField supports text input, you just need to set the type property 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

3 purplewind 03.02.09 at 4:31 pm

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 ?

4 purplewind 03.02.09 at 4:35 pm

I have read all FTE classe scarefully. .
But I haven’t found a class like that .

5 Peter deHaan 03.02.09 at 5:18 pm

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

6 purplewind 03.03.09 at 4:29 pm

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.^^

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: