Package | com.ghostwire.ui.controls |
Class | public class uiImage |
Inheritance | uiImage ![]() ![]() |
uiImage
component is used to display an image, which can either be a movieclip symbol
in the library, or an external SWF/GIF/JPG/PNG file.
Multi-State Image
If you supply multiple sources, you will create a multi-state image, ie. an image that changes
according to its current state. See the entry for the source
property for details.
~ This class is available in Aspire UI Components Lite Edition ~
Property | Defined by | ||
---|---|---|---|
![]() | alignX : Number
Indicates how the component would like to be aligned horizontally within its allocated space.
| uiComponent | |
![]() | alignY : Number
Indicates how the component would like to be aligned vertically within its allocated space.
| uiComponent | |
![]() | background : Object
Indicates the style of the background for this component.
| uiComponent | |
![]() | container : uiComponent
Indicates the
uiComponent instance that contains this instance. | uiComponent | |
![]() | depth : int
Indicates how deep the component is in the containment hierarchy.
| uiComponent | |
![]() | desiredAllocationHeight : int
Indicates the vertical space this component would like to be allocated.
| uiComponent | |
![]() | desiredAllocationWidth : int
Indicates the horizontal space this component would like to be allocated.
| uiComponent | |
![]() | enabled : Boolean
Indicates whether the component is enabled for user interaction.
| uiComponent | |
![]() | fillX : Boolean
Indicates whether or not the component should automatically expand or shrink to fill its allocated
horizontal space.
| uiComponent | |
![]() | fillY : Boolean
Indicates whether or not the component should automatically expand or shrink to fill its allocated
vertical space.
| uiComponent | |
![]() | focusPadding : Object
Indicates the thickness of the interior space from the edge of the component to the focus
rectangle.
| uiComponent | |
![]() | focusRect : Object
Indicates the class to use when rendering the rectangle around the component to indicate that it
is in focus.
| uiComponent | |
![]() | height : Number
Indicates the current
height of the component. | uiComponent | |
maintainAspectRatio : Boolean
Indicates whether the image should maintain its aspect ratio when resizing via the
setSize() method. | uiImage | ||
![]() | margin : Object
Indicates the thickness of the space surrounding the component.
| uiComponent | |
![]() | maxHeight : int
Indicates the upper limit for
height . | uiComponent | |
![]() | maxWidth : int
Indicates the upper limit for
width . | uiComponent | |
![]() | minHeight : int
Indicates the lower limit for
height . | uiComponent | |
![]() | minWidth : int
Indicates the lower limit for
width . | uiComponent | |
![]() | padding : Object
Indicates the thickness of the interior space from the edge of the component to the content area,
which is where child components, if any, are contained.
| uiComponent | |
path : String = "assets/images/" [static]
Indicates the path to the folder containing external image resources (SWF/GIF/JPG/PNG files).
| uiImage | ||
![]() | skin : String
Indicates the name of the skin to use for this component instance.
| uiComponent | |
smoothing : Boolean
Controls whether or not the bitmap is smoothed when scaled.
| uiImage | ||
source : String
Indicates the source of the current image displayed.
| uiImage | ||
![]() | stretch : Boolean
Indicates whether surplus space available in the parent container should be allocated to this
component.
| uiComponent | |
![]() | textStyle : String
Indicates the style to use for
uiText instances contained in this component. | uiComponent | |
![]() | toolTip : Object
Indicates the content (text) of the tooltip that should be shown when the mouse hovers
over this control.
| uiComponent | |
![]() | uiskin : uiBitmapImage
Returns the
uiBitmapImage rendered as the skin - for advanced users only. | uiComponent | |
![]() | visible : Boolean
Indicates whether or not the component is visible within its container.
| uiComponent | |
![]() | width : Number
Indicates the current
width of the component. | uiComponent |
Method | Defined by | ||
---|---|---|---|
uiImage(src:String = "")
Constructor - creates a new
uiImage instance. | uiImage | ||
clearCache():void
[static]
Clears the cache of bitmap images.
| uiImage | ||
![]() |
invalidate(type:String):void
Invalidates this component's "size", "display", "layout" or "textstyle".
| uiComponent | |
![]() |
move(x:Number, y:Number, noEvent:Boolean = false):void
Moves the component to the specified position, disregarding its allocation.
| uiComponent | |
registerBitmapData(id:String, data:BitmapData):void
[static]
Registers the specified
BitmapData in the image cache, giving it the specified
id . | uiImage | ||
![]() |
removeAllChildren(all:Boolean = false):void
Removes all children from this component.
| uiComponent | |
![]() |
setFocus(flag:Boolean = true):void
Gives this component instance the focus; the component must be on the display list and has its
tabEnabled property set to true , otherwise this method will fail
silently. | uiComponent | |
setSize(width:Number, height:Number, noEvent:Boolean = false):void
Sets the
width and height of the image explicitly. | uiImage | ||
![]() |
setVisible(value:Boolean, noEvent:Boolean = false):void
Sets the visibility of this component instance, dispatching a "show" or "hide" event accordingly.
| uiComponent | |
![]() |
validateNow():void
Validates and render the component instance, and any component instances with
depth higher than itself in the validation queue, immediately. | uiComponent |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched when the image source is changed and the new image is loaded and displayed. | uiImage | |||
![]() |
Dispatched when the component's visible property is changed from true to
false via calling the setVisible() method. | uiComponent | ||
![]() |
Dispatched when the component's position within its parent container has changed via calling the
move() method. | uiComponent | ||
Dispatched when data is received as the download of an external image progresses. | uiImage | |||
![]() |
Dispatched when the component's size has changed via calling the setSize() method. | uiComponent | ||
![]() |
Dispatched when the component's visible property is changed from false to
true via calling the setVisible() method. | uiComponent |
maintainAspectRatio | property |
maintainAspectRatio:Boolean
[read-write]
Indicates whether the image should maintain its aspect ratio when resizing via the
setSize()
method. If set to true
, the dimensions specified
in the setSize()
method becomes the space that will be exerted and the
image will be resized within this space while maintaining its original aspect ratio.
The default value is false
.
public function get maintainAspectRatio():Boolean
public function set maintainAspectRatio(value:Boolean):void
See also
path | property |
public static var path:String = "assets/images/"
Indicates the path to the folder containing external image resources (SWF/GIF/JPG/PNG files). The string value must end with a trailing slash.
Note: changing this value in the middle of an application does not affect existing images that are already loaded from another path.
The default value is "assets/images/"
.
smoothing | property |
smoothing:Boolean
[read-write]
Controls whether or not the bitmap is smoothed when scaled. If true
, the
bitmap is smoothed when scaled. If false
, the bitmap is not smoothed
when scaled.
Applicable only if the source is a Bitmap
.
public function get smoothing():Boolean
public function set smoothing(value:Boolean):void
source | property |
source:String
[read-write]Indicates the source of the current image displayed. The source can either be the name of an external file, or the class name of a movieclip symbol in the library. The component will first attempt to find the symbol in the library. If it is not found, it will attempt to load from external file.
When loading an external image, the value should be the name of the external file in the folder "assets/images/". To load from a different path, prefix the value with "url:", example "url:/images/photos/face.png".
You can supply multiple sources to make a multi-state image (one that changes according
to which state it is in). To supply multiple sources, set this property to a string value
with the following format:
defaultSource|state1|state1Source|state2|state2Source|state3|state3Source|etc...For example:
myIcon.source = "icon.png|over|icon_over.png|down|icon_down.png";
The default source is for the default "up" state.
The other possible states are:
over down disabled emphasized emphasized_over emphasized_down selected selected_over selected_down selected_disabledImplementation
public function get source():String
public function set source(value:String):void
uiImage | () | constructor |
public function uiImage(src:String = "")
Constructor - creates a new uiImage
instance.
src:String (default = " ") — A String value specifying the source of the image. You may supply multiple
sources here to create a multi-state image. See the entry for source property for
details.
|
See also
clearCache | () | method |
public static function clearCache():void
Clears the cache of bitmap images. When you load external GIF/JPG/PNG bitmap images, the
uiImage
class will keep a cache of the loaded bitmapData
. In this
way, the same bitmapData
can be reused quickly across different
uiImage
instances. Calling the clearCache()
method clears this
cache (forcing image files to be reloaded next time they are requested).
Note: this will not clear the cache for an image that is currently being loaded, since it will not yet be in the cache.
~ Added in version 1.2.3 ~
registerBitmapData | () | method |
public static function registerBitmapData(id:String, data:BitmapData):void
Registers the specified BitmapData
in the image cache, giving it the specified
id
. Subsequently, you will be able to use the id
as an image source.
uiImage.registerBitmapData("LOGO", logoBitmapData); var img:uiImage = new uiImage("LOGO"); addChild(img);
You can also use this method to (unregister) clear the cache of a specific id
by passing null
for the data
parameter.
To clear everything in the cache, use the clearCache()
method.
~ Added in version 1.3.0 ~
Parametersid:String — A String indicating the name to assign to the BitmapData .
|
|
data:BitmapData — A BitmapData to be registered in the cache.
|
setSize | () | method |
public override function setSize(width:Number, height:Number, noEvent:Boolean = false):void
Sets the width
and height
of the image explicitly.
If you would like to resize the image while retaining its aspect ratio, you should specify
only width or height, and set the other side as -1
. For example,
setSize(100,-1)
will resize the image to 100 pixels wide, and the height will
be computed based on the original aspect ratio.
The other way to resize the image while maintaining aspect ratio is to set the
maintainAspectRatio
property to true
, in which case the
width
and height
parameters specified when calling this method
simply indicates the space within which the image will reside.
width:Number |
|
height:Number |
|
noEvent:Boolean (default = false )
|
See also
change | event |
flash.events.Event
Dispatched when the image source is changed and the new image is loaded and displayed.
progress | event |
flash.events.ProgressEvent.PROGRESS
Dispatched when data is received as the download of an external image progresses. You can listen to this event and track the download progress.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
bytesLoaded | The accumulated number of bytes loaded at the time the listener processes the event. |
bytesTotal | The total number of bytes that will ultimately be loaded if the loading process completes successfully. |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The network object reporting progress. |