Home Flex Conversion of temperature from kelvin to Celsius:



Conversion of temperature from kelvin to Celsius:
Posted on: April 3, 2006 at 12:00 AM
It is a very famous example and almost everyone of us have done this example once in any language.

Conversion of temperature from kelvin to Celsius:

     

 

It is a very famous example and almost everyone of us have done this example once in any language. So let's see how to do this conversion in flex. We'll come to know how to convert using different GUI of flex. Also in this tutorial we'll see how to put the mxml and action script section in separate
  files, and how to access the action script file from mxml file.

 

 

 

 

 

 



temperature.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
  <mx:Script  source="temperature.as"/>
  <mx:Panel title="Convert Temperature"  paddingBottom="10" paddingTop="10"  paddingLeft="10" paddingRight="10" x="138" y="44">
  <mx:HBox>  
    <mx:Label text="Farenheit" id="f"/>
    <mx:TextInput id="far"/>
    <mx:Button id="button" label="convert" click="convert()"/>
    <mx:TextInput id="cel"/>   
  </mx:HBox>
  </mx:Panel>
</mx:Application>

  temperature.as
public function convert():void
    {
      var f:Number=Number(far.text);
      var c:Number=Number(cel.text);
      c=Math.round((f-32)/1.8*10)/10;
      cel.text=String(c);
    }

   
  

  

 

Related Tags for Conversion of temperature from kelvin to Celsius::


More Tutorials from this section

Ask Questions?    Discuss: Conversion of temperature from kelvin to Celsius:  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.