topical media & game development

talk show tell print

professional-flex-code-08-Product.mx

professional-flex-code-08-Product.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" 
    borderStyle="outset" height="120" width="120">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    [Bindable]
    public var productName:String;
    [Bindable]
    public var productPrice:Number;
    private function clickHandler():void{
      Alert.show(this.qty.value + " " + this.productName + "(s) added to cart");
    }
    ]]>
    </mx:Script>
  
    <mx:CurrencyFormatter id="usdFormatter" precision="2" 
      currencySymbol="" decimalSeparatorFrom="."
      decimalSeparatorTo="." useNegativeSign="true" 
      useThousandsSeparator="true" alignSymbol="left"/>    
    <mx:Label text="{this.productName}" horizontalCenter="1" verticalCenter="-49"/>
    <mx:Label text="{usdFormatter.format(this.productPrice)}" width="60" x="4" y="45"/>
    <mx:NumericStepper id="qty" minimum="1" maximum="10" stepSize="1" width="58" x="53" y="43"/>
    <mx:Button label="Add to Cart"  bottom="10" horizontalCenter="0" click="clickHandler();"/>
  </mx:Canvas>
  


(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.