Apache Flex 4.16.1 API Reference | All Packages | All Classes | Index | Frames No Frames |
ButtonAsset

Package | mx.core
Class | public class ButtonAsset
Inheritance | ButtonAsset FlexSimpleButton flash.display.SimpleButton
Implements | IFlexAsset, IFlexDisplayObject

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

ButtonAsset is a subclass of the flash.display.SimpleButton class which represents button symbols that you embed in a Flex application from a SWF file produced by Flash. It implements the IFlexDisplayObject interface, which makes it possible for a SimpleButtonAsset to be displayed in an Image control, or to be used as a container background or a component skin.

This class is included in Flex for completeness, so that any kind of symbol in a SWF file produced by Flash can be embedded in a Flex application. However, Flex applications do not typically use embedded SimpleButtons. Refer to more commonly-used asset classes such as BitmapAsset for more information about how embedded assets work in Flex.

Public Properties

| Property | Defined By
--- | --- | ---
|  | measuredHeight : Number [read-only] The measured height of this object. | ButtonAsset
|  | measuredWidth : Number [read-only] The measured width of this object. | ButtonAsset

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | ButtonAsset() Constructor. | ButtonAsset
|  | move(x:Number, y:Number):void Moves this object to the specified x and y coordinates. | ButtonAsset
|  | setActualSize(newWidth:Number, newHeight:Number):void Sets the actual size of this object. | ButtonAsset
|  | toString():String [override] Returns a string indicating the location of this object within the hierarchy of DisplayObjects in the Application. | FlexSimpleButton

Property Detail

measuredHeight | property

`measuredHeight:Number` [read-only]

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

The measured height of this object.

This is typically hard-coded for graphical skins because this number is simply the number of pixels in the graphic. For code skins, it can also be hard-coded if you expect to be drawn at a certain size. If your size can change based on properties, you may want to also be an ILayoutManagerClient so a `measure()` method will be called at an appropriate time, giving you an opportunity to compute a `measuredHeight`.

Implementation
`public function get measuredHeight():Number`

measuredWidth | property |

`measuredWidth:Number` [read-only]

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

The measured width of this object.

This is typically hard-coded for graphical skins because this number is simply the number of pixels in the graphic. For code skins, it can also be hard-coded if you expect to be drawn at a certain size. If your size can change based on properties, you may want to also be an ILayoutManagerClient so a `measure()` method will be called at an appropriate time, giving you an opportunity to compute a `measuredHeight`.

Implementation
`public function get measuredWidth():Number`
Constructor Detail

ButtonAsset | () | Constructor

`public function ButtonAsset()`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Constructor.

Method Detail

move | () | method

`public function move(x:Number, y:Number):void`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Moves this object to the specified x and y coordinates.

Parameters

| `x:Number` — The new x-position for this object.
| `y:Number` — The new y-position for this object.

setActualSize | () | method |

`public function setActualSize(newWidth:Number, newHeight:Number):void`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Sets the actual size of this object.

This method is mainly for use in implementing the `updateDisplayList()` method, which is where you compute this object's actual size based on its explicit size, parent-relative (percent) size, and measured size. You then apply this actual size to the object by calling `setActualSize()`.

In other situations, you should be setting properties such as `width`, `height`, `percentWidth`, or `percentHeight` rather than calling this method.

Parameters

| `newWidth:Number` — The new width for this object.
| `newHeight:Number` — The new height for this object.

Wed Nov 15 2017, 09:50 AM +01:00