Packagecom.joebillman.controls
Classpublic class Button
InheritanceButton Inheritance flash.display.Sprite

Button: Creates a Button with only code.

View the examples



Public Properties
 PropertyDefined By
  color : uint
Button
  downColor : uint
Button
  enabled : Boolean
Button
  hasDownShadow : Boolean
Button
  hasInset : Boolean
Button
  hasTextAccent : Boolean
Button
  height : Number
[override]
Button
  icon : String
Button
  iconPercentageOfHeight : Number
Button
  iconX : Number
Button
  label : String
Button
  overColor : uint
Button
  roundness : Number
Button
  sizeToIcon : Boolean
Button
  sizeToText : Boolean
Button
  strokeGradient : Array
Button
  strokeOverGradient : Array
Button
  text : String
Button
  textAccentColor : uint
Button
  textColor : uint
Button
  textField : TextField
[read-only]
Button
  textFormat : TextFormat
Button
  textOverColor : uint
Button
  textPadding : Number
Button
  textSize : Number
Button
  width : Number
[override]
Button
Public Methods
 MethodDefined By
  
Button(label:String = Label, buildDefault:Boolean = true)
Button
  
build():void
Button
  
cleanup():void
Button
  
redraw():void
Button
Property Detail
colorproperty
color:uint


Implementation
    public function get color():uint
    public function set color(value:uint):void
downColorproperty 
downColor:uint


Implementation
    public function get downColor():uint
    public function set downColor(value:uint):void
enabledproperty 
enabled:Boolean


Implementation
    public function get enabled():Boolean
    public function set enabled(value:Boolean):void
hasDownShadowproperty 
hasDownShadow:Boolean


Implementation
    public function get hasDownShadow():Boolean
    public function set hasDownShadow(value:Boolean):void
hasInsetproperty 
hasInset:Boolean


Implementation
    public function get hasInset():Boolean
    public function set hasInset(value:Boolean):void
hasTextAccentproperty 
hasTextAccent:Boolean


Implementation
    public function get hasTextAccent():Boolean
    public function set hasTextAccent(value:Boolean):void
heightproperty 
height:Number[override]


Implementation
    public function get height():Number
    public function set height(value:Number):void
iconproperty 
icon:String


Implementation
    public function get icon():String
    public function set icon(value:String):void
iconPercentageOfHeightproperty 
iconPercentageOfHeight:Number


Implementation
    public function get iconPercentageOfHeight():Number
    public function set iconPercentageOfHeight(value:Number):void
iconXproperty 
iconX:Number


Implementation
    public function get iconX():Number
    public function set iconX(value:Number):void
labelproperty 
label:String


Implementation
    public function get label():String
    public function set label(value:String):void
overColorproperty 
overColor:uint


Implementation
    public function get overColor():uint
    public function set overColor(value:uint):void
roundnessproperty 
roundness:Number


Implementation
    public function get roundness():Number
    public function set roundness(value:Number):void
sizeToIconproperty 
sizeToIcon:Boolean


Implementation
    public function get sizeToIcon():Boolean
    public function set sizeToIcon(value:Boolean):void
sizeToTextproperty 
sizeToText:Boolean


Implementation
    public function get sizeToText():Boolean
    public function set sizeToText(value:Boolean):void
strokeGradientproperty 
strokeGradient:Array


Implementation
    public function get strokeGradient():Array
    public function set strokeGradient(value:Array):void
strokeOverGradientproperty 
strokeOverGradient:Array


Implementation
    public function get strokeOverGradient():Array
    public function set strokeOverGradient(value:Array):void
textproperty 
text:String


Implementation
    public function get text():String
    public function set text(value:String):void
textAccentColorproperty 
textAccentColor:uint


Implementation
    public function get textAccentColor():uint
    public function set textAccentColor(value:uint):void
textColorproperty 
textColor:uint


Implementation
    public function get textColor():uint
    public function set textColor(value:uint):void
textFieldproperty 
textField:TextField  [read-only]


Implementation
    public function get textField():TextField
textFormatproperty 
textFormat:TextFormat


Implementation
    public function get textFormat():TextFormat
    public function set textFormat(value:TextFormat):void
textOverColorproperty 
textOverColor:uint


Implementation
    public function get textOverColor():uint
    public function set textOverColor(value:uint):void
textPaddingproperty 
textPadding:Number


Implementation
    public function get textPadding():Number
    public function set textPadding(value:Number):void
textSizeproperty 
textSize:Number


Implementation
    public function get textSize():Number
    public function set textSize(value:Number):void
widthproperty 
width:Number[override]


Implementation
    public function get width():Number
    public function set width(value:Number):void
Constructor Detail
Button()Constructor
public function Button(label:String = Label, buildDefault:Boolean = true)



Parameters
label:String (default = Label)
 
buildDefault:Boolean (default = true)
Method Detail
build()method
public function build():void

cleanup()method 
public function cleanup():void

redraw()method 
public function redraw():void

Examples
The following example creates a button and modifies some of its properties so that it looks like a default flash button.

Note: This button this makes is ugly. If you want a better looking button just go with the default settings.

     package
     {
         import bf.controls.Button;
     
         import flash.display.MovieClip; 
     
         public class ButtonExample extends MovieClip
         {
     
             private var btn:Button;
     
             public function ButtonExample()
             {
                 _init();
             }
     
             private function _init():void
             {
               btn = new Button("Label", false);
               btn.color = 0xF1F1F1;
               btn.downColor = btn.color;
                   btn.overColor = btn.color;
               btn.hasInset = false;
                btn.hastextAccent = false;
                btn.strokeGradient = [0xB7BABC, 0x585F63];
                btn.strokeOverGradient = [0x009DFF, 0x0075BF];
                   btn.textSize = 11;
                addChild(btn);
                   btn.build();
             }
         }
     }