Embed calculation logic into Button click event : Button Event « Components « Flex
- Flex
- Components
- Button Event
Embed calculation logic into Button click event

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Panel title="My Application" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
<mx:HBox>
<mx:Label text="Temperature in Fahrenheit:" />
<mx:TextInput id="fahrenheit" width="120" />
<mx:Button label="Convert" click="celsius.text=String((Number(fahrenheit.text)-32)/1.8);" />
<mx:Label text="Temperature in Celsius:" />
<mx:Label id="celsius" width="120" fontSize="24" />
</mx:HBox>
</mx:Panel>
</mx:Application>
Related examples in the same category