flexlib :: library Documentation | All Packages | All Classes | Index | Frames No Frames |
IconLoader

Package | flexlib.controls
Class | public class IconLoader
Inheritance | IconLoader mx.core.UIComponent

The <codeph>IconLoader</codeph> component converts a Macintosh OS X (.icns) or Windows XP (.ico) icon file, along with its alpha mask, to a Flex 2 UIComponent. The interface is similar to that of <codeph>mx:Image</codeph> in that the <codeph>source</codeph> property can be set to either an embedded icon or a URL that an asset can be loaded from. <p>The current implementations of the .ico and .icns parsers only support 32 bit icons. For .icns files, this means that the following types are supported, along with their associated masks: 'is32', 'il32', 'ih32', and 'it32'. For .ico files, only "XP" style icons, where an 8-bit alpha mask is included in the image data, are supported.</p> <p>Example MXML usage:</p> <pre> <IconLoader xmlns="flexlib.controls.*" source="@Embed( source='assets/app_icon.icns', mime-type='application/octet-stream' )" scaleContent="true"> </pre>

Public Properties

| Property | Defined By
--- | --- | ---
|  | scaleContent : Boolean Enables or disables scaling of the icon content to fit this control's bounds. | IconLoader
|  | source : Object Sets the location of the icon data. | IconLoader

Public Methods

| Method | Defined By
--- | --- | ---
|  | IconLoader() Constructor | IconLoader

Styles

| Style | Description | Defined By
--- | --- | --- | ---
|  | brokenImageBorderSkin | Type: Class CSS Inheritance: no Skin used to display border around "broken link" image The default value is`BrokenImageBorderSkin`. | IconLoader
|  | brokenImageSkin | Type: Class CSS Inheritance: no Skin displayed when a URL cannot be loaded The default value is`BrokenImageSkin`. | IconLoader

Property Detail

scaleContent | property

`scaleContent:Boolean`

Enables or disables scaling of the icon content to fit this control's bounds. <p>When this property is set to <codeph>true</codeph>, the icon's image will be scaled to fill the bounds of this control. When calculating the scale ratio, the lesser of the bouding width and height is used.</p> <p>If this property is set to <codeph>false</codeph> an icon is chosen from those contained in the source file based on the size of this control.</p> <p>Icon files typically contain icons at multiple sizes. When choosing which icon to display, this control considers the value of the <codeph>scaleContents</codeph> propety. If <codeph>scaleContents</codeph> is <codeph>false</codeph>, the largest icon that does not exceed the control's bounds is chosen. When the value is <codeph>true</codeph>, the icon chosen is the smallest icon that exceeds this control's bounds.</p>

The default value is `false`.

This property can be used as the source for data binding.

Implementation
`public function get scaleContent():Boolean`
`public function set scaleContent(value:Boolean):void`

source | property |

`source:Object`

Sets the location of the icon data. <p>This property can be set to either a String or a class that extends ByteArray. In the case where the source is a String, it is treated as a URL from which an icon file can be retrieved. Setting <codeph>source</codeph> to a String initiates a process where the image is retrieved from the URL. In the case of a ByteArray subclass, the class is immediately parsed and the display list is updated. The latter scenario is the result of using the @Embed(...) compiler directive.</p> <p>Note that when using the @Embed(...) directive, the <codeph>mime-type</codeph> property of the @Embed directive must be set to <codeph>application/octet-stream</codeph></p>

This property can be used as the source for data binding.

Implementation
`public function get source():Object`
`public function set source(value:Object):void`
Constructor Detail

IconLoader | () | Constructor

`public function IconLoader()`

Constructor

Dimanche Juin 19 2011, 03:12 PM +02:00