topical media & game development

talk show tell print

professional-flex-code-26-PowWidget.mx

professional-flex-code-26-PowWidget.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Module 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    backgroundColor="#EEEEEE"
    borderStyle="solid"
    borderThickness="3"
    layout="vertical">
    
    <mx:Form>
    <mx:Script>
        <![CDATA[
          private function getValue( base:String, exp:String ):String
          {
            if( Number( base ) > 1 && Number( exp ) > 1 )
              return Math.pow( Number( base ), Number( exp ) ).toString();
            else
              return "invalid value";
          }
        ]]>
    </mx:Script>
    <mx:FormItem label="Base:">
      <mx:TextInput id="txtBase" />
    </mx:FormItem>
    <mx:FormItem label="Exponent:">
      <mx:TextInput id="txtExp" />
    </mx:FormItem> 
    <mx:FormItem label="Value:" fontWeight="bold">
      <mx:TextInput id="txtValue" 
        text="{ getValue( txtBase.text, txtExp.text ) }"/>
      </mx:FormItem>        
    </mx:Form>
  </mx:Module>


(C) Æliens 04/09/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.