ImageHolder

Package:
Class:
Inheritance:
biz.flashscript.components.imageholder
public class ImageHolder
MovieClip
The ImageHolder class is the base class for the ImageHolder component. This component can load and size images and swfs. To create an instance of the ImageHolder component place an instance of the component on the main timeline or call the ImageHolder class.
Public Properties
Property Defined By
urlObject :String
Defines the URL for an image or swf.
ImageHolder
holderWidth :int
Defines the width of the component.
ImageHolder
holderHeight :int
Defines the height of the component.
ImageHolder
imgLoaded :Boolean
Tells if the component is loaded.
ImageHolder
Public Methods
Method Defined By
All inherited methods of the AbstractClass (base class is Sprite) class N/A
ImageHolder()
Creates a new instance of the ImageHolder component.
ImageHolder
loadImage(img:String)
Function is used to activate the alert.
ImageHolder
Events
Event Defined By
All inherited events for the Sprite class.

imgHolderLoaded

This event is dispatched when the component is loaded.

ImageHolder
Property Detail

urlObject property
urlObject:String [read-write]

This defines the URL for an image.

Implementation

public function get urlObject():String
public function set urlObject(value:String):void

holderWidth property
holderWidth:int [read-write]

This defines the width of the component.

The default value is 0.

Implementation

public function get holderWidth():int
public function set holderWidth(value:int):void

holderHeight property
holderHeight:int [read-write]

This defines the height of the component.

The default value is 0.

Implementation

public function get holderHeight():int
public function set holderHeight(value:int):void

imgLoaded property
imgLoaded:Boolean [read-write]

This tells if the component is loaded.

Implementation

public function get imgLoaded():Boolean
public function set imgLoaded(value:Boolean):void
Constructor Detail
ImageHolder ()  Constructor
public function ImageHolder()
To initialize an instance use new ImageHolder().
Method Detail

loadImage()  method
public function loadImage(img:String):void

This method allows to load an image in the component.

Parameters

  • img:String ____ Specifies the image URL.
Event Detail

imgHolderLoaded event

Event Object Type: biz.flashscript.components.imageholder.ImageHolder
Event.type property = biz.flashscript.components.imageholder.ImageHolder.IMGHOLDER_LOADED

Dispatched when the component is loaded.

Examples
Create a new fla file and name it ImageHolderExample.fla. Put the name ImageHolderExample in the class field. Place one ImageHolder component on the timeline, name it holder and place one CustomButton component and name it loadBut. Save the file in the same folder where the biz folder is located. Create an actionscript file and name it ImageHolderExample.as. Put the script below in the as file.

package 
{
	import flash.display.Sprite;
	import biz.flashscript.components.buttons.CustomButton;
	import flash.events.MouseEvent;
	import flash.events.Event;
	import biz.flashscript.components.imageholder.Imageholder;
	
	public class ImageholderExample extends Sprite
	{
		public var holder:Imageholder;
		public var loadBut:CustomButton;
		
		public function ImageholderExample ():void
		{
			holder.holderHeight = 150;
			holder.holderWidth = 200;
			holder.addEventListener("imgHolderLoaded", lf);
			loadBut.addEventListener (MouseEvent.CLICK,mcHandler);
		}
		private function mcHandler (event:MouseEvent):void
		{
			holder.loadImage("images/A0.jpg");
		}
		private function lf (event:Event):void
		{
			trace("LOADED");
		}
	}
}
Get Adobe Flash player