qnx.fuse.ui.buttons.IconButton

IconButton

Properties | Methods | Examples


Packageqnx.fuse.ui.buttons
Classpublic class IconButton
InheritanceIconButton Inheritance Button Inheritance SkinnableComponent Inheritance UIComponent Inheritance flash.display.MovieClip

The IconButton class enables you to place an image at the center of a button:

An icon button.



Class information:
PlayBook Tablet OS Version:   1.0.6

View the examples

See also

Button
LabelButton



Public Properties

 PropertyDefined By
 InheritedexplicitHeight : Number
[read-only] Returns the explicit height (actual height, in pixels) of the UI component.
UIComponent
 InheritedexplicitWidth : Number
[read-only] Returns the explicit width (actual width, in pixels) of the UI component.
UIComponent
 InheritedincludeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
 InheritedlayoutData : Object
Returns the layout data for the object.
UIComponent
 InheritedminHeight : Number
Gets or sets the minimum preferred height of the control.
UIComponent
 InheritedminWidth : Number
Gets or sets the minimum preferred width of the control.
UIComponent
 Inheritedselected : Boolean
Gets or sets the selected property of the button.
Button
 Inheritedstate : String
Gets or sets the state of the component.
SkinnableComponent
 Inheritedtoggle : Boolean
Gets or sets the toggle property of the button.
Button

Public Methods

 MethodDefined By
  
Constructs an IconButton instance.
IconButton
 Inherited
childChanged(resizedChild:DisplayObject = null):Boolean
Notifies the UIComponent that one or more of its children has changed in a manner that may affect this object's layout.
UIComponent
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
Returns the size options for the given control.
UIComponent
 Inherited
Calling this method results in a call to the components validateDisplayList() method before the display list is rendered.
UIComponent
 Inherited
Calling this method results in a call to the components validateProperties() method before the display list is rendered.
UIComponent
 Inherited
measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
This method calls doMeasure() in order to calculate the preferred size of the control.
UIComponent
 Inherited
setActualSize(w:Number, h:Number):void
Sets the width and height of the object without setting the explicitWidth and explicitHeight.
UIComponent
  
setIcon(image:Object, state:String):void
Sets the icon for the button.
IconButton
 Inherited
setLayoutBounds(bounds:Rectangle):void
Sets the receiver's size and location to the rectangular area specified by the arguments.
UIComponent
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
 Inherited
setSkin(newSkin:Object):void
Set the skin object on the component for it to render.
SkinnableComponent
 Inherited
Validates the display list of the component by calling the updateDisplayList().
UIComponent
 Inherited
Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary.
UIComponent
 Inherited
Validates the properties of the component by calling the commitProperties() method.
UIComponent

Protected Methods

 MethodDefined By
 Inherited
Process properties of the component.
UIComponent
 Inherited
Process the state of the component.
UIComponent
 Inherited
doMeasure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
Performs a measurement on the control, and returns a LayoutMeasurement instance containing the available width and height within the layout.
UIComponent
 Inherited
flushCache():void
Invoked as part of parentLayoutChanged.
UIComponent
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
Invalidates the parent's size and display list if includeInLayout property is set to true.
UIComponent
 Inherited
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Sets the size and position of the children of the component.
UIComponent
 Inherited
updateSkin(unscaledWidth:Number, unscaledHeight:Number):void
Updates the skin.
SkinnableComponent

Constructor Detail

IconButton()


public function IconButton()

Constructs an IconButton instance.

Method Detail

setIcon()


public function setIcon(image:Object, state:String):void

Sets the icon for the button. The icon is positioned in the center of the button.

The setIcon takes a path to an image (relative to your application file), a Bitmap instance, or a BitmapData instance. In the following example, a path to an image in the source project is passed into the setIcon method.

         myIconButton = new IconButton();
         myIconButton.setIcon("assets/icon.gif");
         

In the following example, an image is embedded in a class called Settings. The Settings object is instantiated as the argument for the setIcon() method.

         [Embed(source="assets/settings.png")]
         public static var Settings:Class;

         myIconButton.setIcon( new Settings() );
         

Parameters

image:Object — The icon to be set. A String representing the URL to an external image, a Bitmap instance, or a BitmapData instance.
state:String (default = NaN)

Examples

In the following example, a .gif is placed on an IconButton instance. The LocaleManager class's getCurrentLocale() method is called to reference an image in the resource folder of the current locale.

package
{
    import flash.display.Sprite;
    import flash.filesystem.File;

    import qnx.fuse.ui.buttons.IconButton;
    import qnx.fuse.ui.buttons.Button;
    import qnx.locale.LocaleManager;

    [SWF(height="600", width="1024", frameRate="30",
     backgroundColor="#FFFFFF")]
    public class buttonTest extends Sprite
    {

        private var myIconButton:IconButton;

        public function buttonTest()
        {
            initializeIconButton();

        }

        private function initializeIconButton():void
        {
            myIconButton = new IconButton();
            myIconButton.setIcon( LocaleManager.getLocalePath() +
                "/icon.gif");
            myIconButton.width = 100;
            myIconButton.setPosition(30, 30);

            this.addChild(myIconButton);

        }
    }
}