topical media & game development

talk show tell print

explorer-controls-RadioButtonGroupExample.mx

explorer-controls-RadioButtonGroupExample.mx [swf] flex


  <?xml version="1.0"?>
  <!-- Simple example to demonstrate RadioButtonGroup control. -->
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  
      <mx:Script>
              <![CDATA[
          
              import mx.controls.Alert;
              import  mx.events.ItemClickEvent;
          
          // Event handler function to display the selected button
          // in an Alert control.
                  private function handleCard(event:ItemClickEvent):void {
                          if (event.currentTarget.selectedValue == "AmEx") {
                                          Alert.show("You selected American Express") 
                          } 
                          else {
                                  if (event.currentTarget.selectedValue == "MC") {
                                          Alert.show("You selected MasterCard") 
                                  } 
                                  else {
                                          Alert.show("You selected Visa") 
                                  }
                          } 
                  }
              ]]>
      </mx:Script>
  
      <mx:Panel title="RadioButtonGroup Control Example" height="75%" width="75%" 
          paddingTop="10" paddingLeft="10">
      
          <mx:Label width="100%" color="blue" 
              text="Select a type of credit card."/>
  
          <mx:RadioButtonGroup id="cardtype" itemClick="handleCard(event);"/>
          <mx:RadioButton groupName="cardtype" id="americanExpress" value="AmEx" 
              label="American Express" width="150" />
          <mx:RadioButton groupName="cardtype" id="masterCard" value="MC" 
              label="MasterCard" width="150" />
          <mx:RadioButton groupName="cardtype" id="visa" value="Visa" 
              label="Visa" width="150" />
                  
      </mx:Panel>                
  </mx:Application>


(C) Æliens 27/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.