Search code examples
actionscript-3eventstextboxtextchanged

AS3 TextChange Event?


I just want to know if there is any TextChange Event or equivalent to that in AS3? I am currently using Adobe Flash CS3 with my AS3 files and I have to detect whether or not my TextTool's value has changed or not.

With my data being integers ranging from -4.440 to 3.560, I obviously cannot use the != operator.

If anyone knows how to achieve this on integers, please let me know. Thanks. :D


Solution

  • the same is in Flash too, just use addEventListener to your text component:

    `

            import spark.events.TextOperationEvent;
    
            protected function textinput1_changeHandler(event:TextOperationEvent):void
            {
                var digit:Number=new Number((event.currentTarget as TextInput).text);
                if(digit!=NaN)
                    Alert.show(digit.toString());//do what you want
    
            }
    
        ]]>
    </fx:Script>
    
    <s:TextInput change="textinput1_changeHandler(event)"/>
    

    `