One MXML document (ActionScript event handling logic in MXML tag)

The following code shows the ActionScript event handling logic inside the MXML tag's click event:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
   <mx:Panel title="My Application" marginTop="10" marginBottom="10"
      marginLeft="10" marginRight="10" >
      <mx:HBox>
         <mx:Label text="Temperature in Farenheit:"/>
         <mx:TextInput id="farenheit" width="120"/>
         <mx:Button label="Convert"
            click="celsius.text=(farenheit.text-32)/1.8;" />
         <mx:Label text="Temperature in Celsius:"/>
      <mx:Label id="celsius" width="120" fontSize="48"/>
      </mx:HBox>
   </mx:Panel>
</mx:Application>

Version 1.5

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/15/flex_docs_en/00000070.htm