IT기술/Flex

flex 7 url, checkbox, radiobutton, radiobuttongroup

dobbby 2008. 11. 19. 19:16
반응형



ButtonTest.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   public function NavigateToURL():void {
             var url:String = "http://www.google.com";
             var request:URLRequest = new URLRequest(url);
             try {           
                 navigateToURL(request,"_self");
             }
             catch (e:Error) {
                 // handle error here
             }
         }
        
         public function ILikeIt(event:Event):void{
          var str:String = "";
          if(f1.selected){
           str += f1.label+" ";
          }
          if(f2.selected){
           str += f2.label+" ";
          }
          if(f3.selected){
           str += f3.label+" ";
          }
          mx.controls.Alert.show(str);
         }
        
         public function ILoveIt(event:Event):void{
          if(r1.selected){
           mx.controls.Alert.show(r1.label);
          }
          if(r2.selected){
           mx.controls.Alert.show(r2.label);
          }
          if(r3.selected){
           mx.controls.Alert.show(r3.label);
          } 
         }
        
         public function IHateIt(event:Event):void{
          mx.controls.Alert.show(String(radiogroup1.selectedValue));
         }
        
  ]]>
 </mx:Script>
 <mx:Button click="NavigateToURL();" fillAlphas="[1.0, 0.0, 1.0, 0.0]" fillColors="[#FFFFFF, #FFFFFF, #FFFFFF, #FFFFFF]" borderColor="#FFFFFF" themeColor="#FFFFFF" cornerRadius="1" height="22" width="97" label="go to google" x="60" y="249"/>
 
 <mx:Panel width="120" height="178" layout="absolute" left="50" top="50">
  <mx:CheckBox x="10" y="70" label="apple" id="f3"/>
  <mx:CheckBox x="10" y="40" label="kiwi" id="f2"/>
  <mx:CheckBox x="10" y="10" label="melon" id="f1"/>
  <mx:Button x="10" y="100" label="Click me" click="ILikeIt(event);"/>
 </mx:Panel>
 
 <mx:Panel width="120" height="178" layout="absolute" left="200" top="50">
  <mx:RadioButton x="10" y="10" label="peach" id="r1"/>
  <mx:RadioButton x="10" y="40" label="banana" id="r2"/>
  <mx:RadioButton x="10" y="70" label="grape" id="r3"/>
  <mx:Button x="10" y="100" label="click me" click="ILoveIt(event);"/>
 </mx:Panel>
 
 <mx:Panel width="120" height="178" layout="absolute" left="350" top="50">
  <mx:Button x="10" y="100" label="click me" click="IHateIt(event);"/>
  <mx:RadioButtonGroup id="radiogroup1"/>
  <mx:RadioButton x="10" y="10" label="mango" groupName="radiogroup1"/>
  <mx:RadioButton x="10" y="40" label="strawberry" groupName="radiogroup1"/>
  <mx:RadioButton x="10" y="70" label="orange" groupName="radiogroup1"/>
 </mx:Panel>
 
</mx:Application>
반응형