Mega Code Archive

 
Categories / Flex / Components
 

Using a switch statement to check the value of TextInput

<?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 mCheck():void         {             switch(myMood.text)             {                 case 'A':                     Alert.show("A");                     break;                  case 'B':                     Alert.show("B");                     break;                 default:                      Alert.show("C");             }         }            </mx:Script>     <mx:TextInput id="myMood" />     <mx:Button label="Check your mood" click="mCheck()" /> </mx:Application>