     public function ButtonSkin()
     {
         super();
-        
-        states = [
-            new State({name:"up"}), 
-            new State({name:"over"}),
-            new State({name:"down"}),
-            new State({name:"disabled", 
-                overrides:[new SetProperty(this, "alpha", 0.5)]})
-        ];
     }
     
     //--------------------------------------------------------------------------

        graphics.drawRect(1, 1, unscaledWidth - 1, unscaledHeight - 2);
        graphics.endFill();
        
        if (hostComponent && hostComponent.label != "")
        {
            lineMetrics = measureText(hostComponent.label);
            textWidth = lineMetrics.width + TEXT_WIDTH_PADDING;
            textHeight = lineMetrics.height + UITextField.TEXT_HEIGHT_PADDING;
        }
        else
        {
            lineMetrics = measureText("Wj");
            textWidth = lineMetrics.width + TEXT_WIDTH_PADDING;
            textHeight = lineMetrics.height + UITextField.TEXT_HEIGHT_PADDING;
        }
        
        var textAlign:String = "center"; // getStyle("textAlign");
        // Map new Spark values that might be set in a selector
        // affecting both Halo and Spark components.
        if (textAlign == "start") 
            textAlign = TextFormatAlign.LEFT;
        else if (textAlign == "end")
            textAlign = TextFormatAlign.RIGHT;
        
        var viewWidth:Number = unscaledWidth;
        var viewHeight:Number = unscaledHeight;
        
        if (iconDisplay)
        {
            iconWidth = iconDisplay.width;
            iconHeight = iconDisplay.height;
        }
        
        if (labelPlacement == ButtonLabelPlacement.LEFT ||
            labelPlacement == ButtonLabelPlacement.RIGHT)
        {
            horizontalGap = gap;
            
            if (iconWidth == 0 || textWidth == 0)
                horizontalGap = 0;
            
            if (textWidth > 0)
            {
                labelWidth = 
                    Math.max(Math.min(viewWidth - iconWidth - horizontalGap -
                        paddingLeft - paddingRight, textWidth), 0);
            }
            else
            {
                labelWidth = 0;
            }
            labelHeight = Math.min(viewHeight, textHeight);
            
            if (textAlign == "left")
            {
                labelX += paddingLeft;
            }
            else if (textAlign == "right")
            {
                labelX += (viewWidth - labelWidth - iconWidth - 
                    horizontalGap - paddingRight);
            }
            else // "center" -- default value
            {
                labelX += ((viewWidth - labelWidth - iconWidth - 
                    horizontalGap - paddingLeft - paddingRight) / 2) + paddingLeft;
            }
            
            if (labelPlacement == ButtonLabelPlacement.RIGHT)
            {
                labelX += iconWidth + horizontalGap;
                iconX = labelX - (iconWidth + horizontalGap);
            }
            else
            {
                iconX  = labelX + labelWidth + horizontalGap; 
            }
            
            iconY  = ((viewHeight - iconHeight - paddingTop - paddingBottom) / 2) + paddingTop;
            labelY = ((viewHeight - labelHeight - paddingTop - paddingBottom) / 2) + paddingTop;
        }
        else
        {
            verticalGap = gap;
            
            if (iconHeight == 0 || !hostComponent || hostComponent.label == "")
                verticalGap = 0;
            
            if (textWidth > 0)
            {
                labelWidth = Math.max(viewWidth - paddingLeft - paddingRight, 0);
                labelHeight =
                    Math.min(viewHeight - iconHeight - paddingTop - paddingBottom - verticalGap, textHeight);
            }
            else
            {
                labelWidth = 0;
                labelHeight = 0;
            }
            
            labelX = paddingLeft;
            
            if (textAlign == "left")
            {
                iconX += paddingLeft;
            }
            else if (textAlign == "right")
            {
                iconX += Math.max(viewWidth - iconWidth - paddingRight, paddingLeft);
            }
            else
            {
                iconX += ((viewWidth - iconWidth - paddingLeft - paddingRight) / 2) + paddingLeft;
            }
            
            if (labelPlacement == ButtonLabelPlacement.TOP)
            {
                labelY += ((viewHeight - labelHeight - iconHeight - 
                    paddingTop - paddingBottom - verticalGap) / 2) + paddingTop;
                iconY += labelY + labelHeight + verticalGap;
            }
            else
            {
                iconY += ((viewHeight - labelHeight - iconHeight - 
                    paddingTop - paddingBottom - verticalGap) / 2) + paddingTop;
                labelY += iconY + iconHeight + verticalGap;
            }
        }
        
        textField.x = Math.round(labelX);
        textField.y = Math.round(labelY);
        textField.height = labelHeight;
        textField.width = labelWidth;
        
        textFieldShadow.x = Math.round(labelX);
        textFieldShadow.y = Math.round(labelY + 1);
        textFieldShadow.height = labelHeight;
        textFieldShadow.width = labelWidth;
        
        if (iconDisplay)
        {                
            iconDisplay.x = Math.round(iconX);
            iconDisplay.y = Math.round(iconY);
        }        
    }
    
    //--------------------------------------------------------------------------
    //
    //  Methods
    //
    //--------------------------------------------------------------------------
    
    /**
     *  @private 
     */ 
    private function hostComponent_contentChangeHandler(event:Event):void 
    {
        updateLabel();
    }
    
    /**
     *  @private 
     */ 
    private function updateLabel():void 
    {
        if (hostComponent != null && textField) 
        {
            textField.text = hostComponent.label;
            textFieldShadow.text = hostComponent.label;
            invalidateSize();
        }
    }

    /**
     *  @private 
     *  TODO (jszeto) fix up this logic
     */ 
    private function applyFXG():void 
    {
        if (currentState == "down") 
        {
            if (bgImg != null)
                removeChild(bgImg);
            bgImg = new Button_bg_down();
        }
        else 
        {
            if (!(bgImg is Button_bg_up)) 
            {
                if (bgImg != null) 
                    removeChild(bgImg);
                bgImg = new Button_bg_up();
            }
        }
        
        if (bgImg != null) 
        {
            // Put the fxg background on the bottom
            addChildAt(bgImg, 0);
            invalidateDisplayList();
        }
    }
    
}
}
    - need a downIconClass style? 
    - should the label be UITextField or another text class?  

    TODO:
    - remove spark ButtonLabelPlacement and move mx ButtonLabelPlacement
*/
/**
 *  Actionscript based skin for mobile applications. The skin supports 
 *  iconClass and labelPlacement. It uses a couple of FXG classes to 
 *  implement the vector drawing.  
 * 
 *  @langversion 3.0
 *  @playerversion Flash 10
 *  @playerversion AIR 1.5
 *  @productversion Flex 4
 */
public class ButtonSkin extends ButtonSkinBase
{	
    
    //--------------------------------------------------------------------------
