TiledBack

Package:
Class:
Inheritance:
biz.flashscript.background
public class TiledBack
Sprite
The TiledBack class allows to create a background of url-encoded objects in a defined area (Timeline, Stage etc). To create a background use the constructor new TiledBack() and add parameters as desired.
Public Properties
Property Defined By
All inherited properties of the Sprite class. N/A
Public Methods
Method Defined By
TiledBack(target:Object, myImage:String, _width:int=0, _height:int=0) TiledBack
Events
Event Defined By

tileComplete

This event is dispatched when the tile background is created.

TiledBack
All inherited events for the Sprite class. N/A
Constructor Detail
TiledBack ()  Constructor
public function TiledBack(target:Object, myImage:String, _width:int=0, _height:int=0)
Intializes a new TiledBack instance with the specified parameters.

Parameters

  • target:Object ____ The target to add tiles.
  • myImage:String ____ URL for the image to create tiles.
  • _width:int=0 ____ Width of the tiled area. When the Stage is the target the width is the stageWidth.
  • _height:int=0 ____ Height of the tiled area. When the Stage is the target the height is the stageHeight.
Event Detail

tileComplete event

Event Object Type: biz.flashscript.background.TiledBack
Event.type property = biz.flashscript.background.TiledBack.TILE_COMPLETE

Dispatched when a "yes" or "no" button is pressed. To detect, which button was pressed use the instance name and the answer property (see example).

Examples
Create a new fla file and name it TiledBack.fla. Place the fla in the same folder as the biz folder. Have an image of your choice ready in a folder named "images". Then create an Actionscript file, name it Tiledback.as and place this script. You should see a tiled background and a rectangle in the center with two images.
package 
{
	import flash.display.Sprite;
	import biz.flashscript.background.TiledBack;
	import flash.events.Event;

	public class Tiledback extends Sprite
	{
		public function Tiledback ():void
		{
			var mystageBack:TiledBack = new TiledBack(stage, "images/a1.jpg");
			mystageBack.alpha = 0.2;
			addChild (mystageBack);
			mystageBack.addEventListener (TiledBack.TILE_COMPLETE, completeHandler);
		}
		private function completeHandler (event:Event):void
		{
			var mySquare:Square = new Square();
			mySquare.x = 133;
			mySquare.y = 112;
			addChild (mySquare);
			var myBack:TiledBack = new TiledBack(mySquare, "images/a2.jpg", mySquare.width - 6, mySquare.height - 6);
			mySquare.addChild (myBack);
			myBack.addEventListener ("tileComplete", tellmeComplete);
		}
		private function tellmeComplete (event:Event):void
		{
			trace ("complete");
		}
	}
}