Pass current event target text to function : Event Target « Event « Flex






Pass current event target text to function

Pass current event target text to function
      

<?xml version='1.0' encoding='UTF-8'?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.controls.Alert;
        public function checkValue(inputValue:String):void
        {
            if(inputValue.length < 5)
                Alert.show("Are you sure there's not that much new?");
        }
        public function submitClicked():void
        {
            Alert.show("User says:" + whatsnew.text + " is new.");
        }
      
    </mx:Script>

        <mx:Label text="What's new?" />
        <mx:TextInput valueCommit="checkValue(event.currentTarget.text)" id="whatsnew" />
        <mx:Button label="Submit" click="submitClicked()" />
    
</mx:Application>

   
    
    
    
    
    
  








Related examples in the same category

1.Get current target from eventGet current target from event
2.Get event target labelGet event target label
3.Display current phase and information about the current targetDisplay current phase and information about the current target
4.Display the current phase and current target's IDDisplay the current phase and current target's ID
5.Use the target property not currentTarget propertyUse the target property not currentTarget property
6.Event target idEvent target id
7.Use Event object to access methods and properties of the target component, or the component that dispatched the event.Use Event object to access methods and properties of the target component, or the component that dispatched the event.
8.Check event current target class nameCheck event current target class name
9.Get event type, event target and event target idGet event type, event target and event target id
10.Check event target id
11.Let current event target show the drop feedbackLet current event target show the drop feedback