Skip navigation
Currently Being Moderated

Adding an effect to a TextInput Control

Nov 16, 2012 3:28 AM

Is there any way to show the text in a TextInput control as though it was being typed in by a user? I have a TextInput defined as follows:


<mx:TextInput id="message2Input"

        width="100%" height="40"

        text="Type Message Here..."





I can change the string value for message2Input.text elsewhere in my mxml application. When I do, that text will be displayed in the control. But it gets displayed in its entirety, instantly. I need to have it displayed as if it was typed for reasons related to a customer demo. So if the string is "Dexter, a very interesting guy", I want it to appear incrementally as






etc etc.


I don't seem to find any control effects for TextInput that allow this when I search the discussion forums. Does anyone have an example where they have done this programmatically? I tried changing message2Input.text within a for loop, "growing" the display text with each loop until the entire string has been "typed in". But I still only see the final complete text string. I suspect this is because the TextInput control only handles one event, and won't loop through a series of re-posts in an event handler. But I'm new to this, and only guessing here.


This is the private function in my Flex mxml app that I use to post the message to the TextInput display:


protected function _insert_chat_item_0(): void


            // this sets the delay to display of the next IM item in the sequence...      

            aoTimers.push(setTimeout(_insert_chat_item_1, 2000));


            // this sets the text that appears in the "I'm typing text" window...

            // TODO: can we make this appear like it is being typed? Have tried everything, with no luck

            message2Input.text = "Dexter, a very interesting guy";


        } // _insert_chat_item_0 for demo: Tom types in his initial message to John


Thanks very much.




More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points