Packageflexlib.controls
Classpublic class IconLoader
InheritanceIconLoader Inheritance mx.core.UIComponent

The IconLoader 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 mx:Image in that the source property can be set to either an embedded icon or a URL that an asset can be loaded from.

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.

Example MXML usage:

  <IconLoader xmlns="flexlib.controls.*"
    source="@Embed( source='assets/app_icon.icns', mime-type='application/octet-stream' )"
    scaleContent="true">
  



Public Properties
 PropertyDefined 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
 MethodDefined by
  
Constructor
IconLoader
Styles
 StyleDescriptionDefined 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
scaleContentproperty
public var scaleContent:Boolean

Enables or disables scaling of the icon content to fit this control's bounds.

When this property is set to true, 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.

If this property is set to false an icon is chosen from those contained in the source file based on the size of this control.

Icon files typically contain icons at multiple sizes. When choosing which icon to display, this control considers the value of the scaleContents propety. If scaleContents is false, the largest icon that does not exceed the control's bounds is chosen. When the value is true, the icon chosen is the smallest icon that exceeds this control's bounds.

The default value is false.

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

sourceproperty 
public var source:Object

Sets the location of the icon data.

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 source 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.

Note that when using the @Embed(...) directive, the mime-type property of the @Embed directive must be set to application/octet-stream

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

Constructor detail
IconLoader()constructor
public function IconLoader()

Constructor