Packageyourminis.api
Classpublic class Chrome
InheritanceChrome Inheritance flash.display.Sprite
Implementsyourminis.api.IChrome

The Chrome class provides a simple interface and customizable, resizable background widget.

See also

Widget.chrome


Public Properties
 PropertyDefined by
  buttonPoint : Point
Used to set the visibility of the dropdown button in the widget chrome
Chrome
  chromeAlpha : Number
Used to set the alpha of the widget chrome.
Chrome
  chromeColor : uint
Used to set the primary color of the widget chrome.
Chrome
  chromeGradient : int
Used to create a downward gradient in the widget, the primary color being the chromeColor.
Chrome
  chromeTexture : BitmapData
Used to set the widget chrome to a textured bitmap.
Chrome
  cornerRadius : int
Used to set the roundness of the widgets corners (default is 10, square corners is 0).
Chrome
  draggable : Boolean
Boolean used to allow the widget to be dragged in free floating environments (such as the gallery sandbox).
Chrome
  editEnabled : Boolean
Used to set the visibility of the dropdown button in the widget chrome
Chrome
  enabled : Boolean
Used to enable/disable the chrome of a widget.
Chrome
  height : Number
height of the widget
Chrome
  resizable : Boolean
Boolean to determine whether or not the widget is resizable (by the user or widget environment--the widget will always be able to be programatically resized).
Chrome
  shadowEnabled : Boolean
Used to set the visibility of the chrome shadow.
Chrome
  visualsEnabled : Boolean
Used to set the visibility of the color picker button in the widget chrome
Chrome
  width : Number
width of the widget
Chrome
Public Methods
 MethodDefined by
  
Chrome(_widget:Widget, initWidth:int, initHeight:int, initColor:uint, ... bounds)
Chrome
  
addDropDownItem(title:String, data:* = null, callback:Function = null, nodeNumber:int = -1):void
Used to add items to the dropdown menu.
Chrome
  
redrawChrome():void
Used to redraw the widget chrome.
Chrome
  
setBounds(minWidth:int, minHeight:int, maxWidth:int, maxHeight:int):*
Used to set the resizable boundaries of the widget.
Chrome
  
setSize(newWidth:Number, newHeight:Number, init:Boolean = false):void
Used to set the dimensions of the chrome in pixels.
Chrome
  
setSkin(skin:String):void
Used to set the skin picture of the chrome.
Chrome
  
setTheme(_color:uint, init:Boolean = false):void
Used to set the theme color of the chrome.
Chrome
  
setTitle(txt:String, xoffset:int = 0, yoffset:int = 0):void
Used to set the text of the title bar in the chrome.
Chrome
  
setView(isFullView:Boolean):void
Used to set the text of the title bar in the chrome.
Chrome
Property detail
buttonPointproperty
buttonPoint:Point  [read-write]

Used to set the visibility of the dropdown button in the widget chrome

Implementation
    public function get buttonPoint():Point
    public function set buttonPoint(value:Point):void

See also


Example
The following sets the position of the copy button to 5 pixels over and 10 pixels down from the upper left corner of the widget.
   import flash.geom.Point
   widget.chrome.buttonPoint = new Point(5,10); 
  

chromeAlphaproperty 
chromeAlpha:Number  [read-write]

Used to set the alpha of the widget chrome. The chrome must be redrawn or resized after setting to have an effect.

Implementation
    public function get chromeAlpha():Number
    public function set chromeAlpha(value:Number):void

See also


Example
The following code sets the widget chrome to completely transparent.
   widget.chrome.chromeAlpha = 0;
   redrawChrome();
  

chromeColorproperty 
chromeColor:uint  [read-write]

Used to set the primary color of the widget chrome. The chrome must be redrawn or resized after setting to have an effect.

Implementation
    public function get chromeColor():uint
    public function set chromeColor(value:uint):void

See also


Example
The following code sets the widget chrome to white.
   widget.chrome.chromeColor = 0xFFFFFF;
   redrawChrome();
  

chromeGradientproperty 
chromeGradient:int  [read-write]

Used to create a downward gradient in the widget, the primary color being the chromeColor. The chrome must be redrawn or resized after setting to have an effect.

Implementation
    public function get chromeGradient():int
    public function set chromeGradient(value:int):void

See also


Example
The following code sets the chromeGradient to black
   widget.chrome.chromeGradient = 0x000000;
   redrawChrome();
  

chromeTextureproperty 
chromeTexture:BitmapData  [read-write]

Used to set the widget chrome to a textured bitmap. The chrome must be resized or redrawn after setting to have an effect.

Implementation
    public function get chromeTexture():BitmapData
    public function set chromeTexture(value:BitmapData):void

See also


Example
The following code sets the widget to be tiled with a dynamically linked bitmap from the library
   widget.chrome.chromeTexture = new GrassBitmap(120,120);
   redrawChrome();
  

cornerRadiusproperty 
cornerRadius:int  [read-write]

Used to set the roundness of the widgets corners (default is 10, square corners is 0).

Implementation
    public function get cornerRadius():int
    public function set cornerRadius(value:int):void

See also


Example
The following code sets the widget to have square corners
   widget.chrome.cornerRadius = 0;
  

draggableproperty 
draggable:Boolean  [read-write]

Boolean used to allow the widget to be dragged in free floating environments (such as the gallery sandbox).

Implementation
    public function get draggable():Boolean
    public function set draggable(value:Boolean):void

See also


Example
The following code disables dragging of the widget
   widget.chrome.draggable = false;
  

editEnabledproperty 
editEnabled:Boolean  [read-write]

Used to set the visibility of the dropdown button in the widget chrome

Implementation
    public function get editEnabled():Boolean
    public function set editEnabled(value:Boolean):void

See also


Example
The following sets the dropdown button to invisible.
   widget.chrome.editEnabled = false; 
  

enabledproperty 
enabled:Boolean  [read-write]

Used to enable/disable the chrome of a widget. Disabled by default for non-API widgets.

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

See also


Example
The following code disables the chrome of the widget
   widget.chrome.enabled = false;
  

heightproperty 
height:Number  [read-write]

height of the widget

Implementation
    public function get height():Number
    public function set height(value:Number):void
resizableproperty 
resizable:Boolean  [read-write]

Boolean to determine whether or not the widget is resizable (by the user or widget environment--the widget will always be able to be programatically resized).

Implementation
    public function get resizable():Boolean
    public function set resizable(value:Boolean):void

See also


Example
The following code disables resizing of the widget;
   widget.chrome.resizable = false;
  

shadowEnabledproperty 
shadowEnabled:Boolean  [read-write]

Used to set the visibility of the chrome shadow. Note that when the chrome shadow is enabled 10 pixels from the with and 10 pixels from the height of the widget are used to give space for the shadow.

Implementation
    public function get shadowEnabled():Boolean
    public function set shadowEnabled(value:Boolean):void

See also


Example
The following disables the chrome shadow.
   widget.chrome.shadowEnabled = false; 
  

visualsEnabledproperty 
visualsEnabled:Boolean  [read-write]

Used to set the visibility of the color picker button in the widget chrome

Implementation
    public function get visualsEnabled():Boolean
    public function set visualsEnabled(value:Boolean):void

See also


Example
The following sets the color picker button to invisible.
   widget.chrome.visualsEnabled = false; 
  

widthproperty 
width:Number  [read-write]

width of the widget

Implementation
    public function get width():Number
    public function set width(value:Number):void
Constructor detail
Chrome()constructor
public function Chrome(_widget:Widget, initWidth:int, initHeight:int, initColor:uint, ... bounds)Parameters
_widget:Widget
 
initWidth:int
 
initHeight:int
 
initColor:uint
 
... bounds
Method detail
addDropDownItem()method
public function addDropDownItem(title:String, data:* = null, callback:Function = null, nodeNumber:int = -1):void

Used to add items to the dropdown menu.

Parameters
title:String — The title of the menu item.
 
data:* (default = null) — data object to pass to the callback function.
 
callback:Function (default = null) — A callback function to call when the item is clicked.
 
nodeNumber:int (default = -1) — If a secondary level menu is desired, specify the node of the primary menu to place this item under.

See also


Example
The following example shows how to change the color of the widget from the dropdown menu:
   widget.addEventListener(widget.DROPDOWN_LOADED,onDropdownLoaded);
   function onDropdownLoaded(evt:Event)
   {
    widget.addItem("Set color: black",0x000000, widget.setTheme);
    widget.addItem("Set color: red"  ,0xFF0000, widget.setTheme);
    widget.addItem("Set color: green",0x00FF00, widget.setTheme);
    widget.addItem("Set color: blue" ,0x0000FF, widget.setTheme);
   }
  

redrawChrome()method 
public function redrawChrome():void

Used to redraw the widget chrome.

See also


Example
The following sets the chromeColor to black, the chromeGradient to white and redraws the chrome
   widget.chrome.setTheme(0x000000);
   widget.chrome.chromeGradient = 0xFFFFFF;
   widget.chrome.redrawChrome();
  

setBounds()method 
public function setBounds(minWidth:int, minHeight:int, maxWidth:int, maxHeight:int):*

Used to set the resizable boundaries of the widget.

Parameters
minWidth:int — the minimum width of the widget
 
minHeight:int — the minimum height of the widget
 
maxWidth:int — the maximum width of the widget
 
maxHeight:int — the maximum height of the widget

Returns
*

See also


Example
The following sets the min dimensions to 200,160 and the max dimensions to 800x600;
   widget.chrome.setBounds(200,160,800,600);
  

setSize()method 
public function setSize(newWidth:Number, newHeight:Number, init:Boolean = false):void

Used to set the dimensions of the chrome in pixels.

Parameters
newWidth:Number — The desired width of the chrome.
 
newHeight:Number — The desired height of the chrome.
 
init:Boolean (default = false)

See also


Example
The following code sets the dimensions of the chrome to 240px x 200px
   widget.chrome.setSize(240,200); 
  

setSkin()method 
public function setSkin(skin:String):void

Used to set the skin picture of the chrome.

Parameters
skin:String — The url of the picture to load.

See also


Example
The following sets the theme to black.
   widget.chrome.setSkin("http://www.example.com/my_picture.jpg"); 
  

setTheme()method 
public function setTheme(_color:uint, init:Boolean = false):void

Used to set the theme color of the chrome.

Parameters
_color:uint — The desired color of the theme.
 
init:Boolean (default = false)

See also


Example
The following sets the theme to black.
   widget.chrome.setTheme(0x000000); 
  

setTitle()method 
public function setTitle(txt:String, xoffset:int = 0, yoffset:int = 0):void

Used to set the text of the title bar in the chrome.

Parameters
txt:String — The desired title text.
 
xoffset:int (default = 0) — The number of pixels to offset the title location by horizontally. Defaults to 0.
 
yoffset:int (default = 0) — The number of pixels to offset the title location by vertically. Defaults to 0.

See also


Example
The following code sets the title of the widget to "Test Widget".
   widget.chrome.setTitle("Test Widget");
  

setView()method 
public function setView(isFullView:Boolean):void

Used to set the text of the title bar in the chrome.

Parameters
isFullView:Boolean — If false, will hide the background of the chrome (but the interface buttons will still be usable).

See also


Example
The following code hides the background of the widget.
   widget.chrome.setView(true);