Packageorg.flintparticles.twoD.zones
Classpublic class BitmapDataZone
ImplementsZone2D

The BitmapData zone defines a shaped zone based on a BitmapData object. The zone contains all pixels in the bitmap that are not transparent - i.e. they have an alpha value greater than zero.



Public Properties
 PropertyDefined by
  bitmapData : BitmapData
The bitmapData object that defines the zone.
BitmapDataZone
  offsetX : Number
A horizontal offset to apply to the pixels in the BitmapData object to reposition the zone
BitmapDataZone
  offsetY : Number
A vertical offset to apply to the pixels in the BitmapData object to reposition the zone
BitmapDataZone
  scaleX : Number
A scale factor to stretch the bitmap horizontally
BitmapDataZone
  scaleY : Number
A scale factor to stretch the bitmap vertically
BitmapDataZone
Public Methods
 MethodDefined by
  
BitmapDataZone(bitmapData:BitmapData, offsetX:Number = 0, offsetY:Number = 0, scaleX:Number = 1, scaleY:Number = 1)
The constructor creates a BitmapDataZone object.
BitmapDataZone
  
contains(x:Number, y:Number):Boolean
The contains method determines whether a point is inside the zone.
BitmapDataZone
  
getArea():Number
The getArea method returns the size of the zone.
BitmapDataZone
  
getLocation():Point
The getLocation method returns a random point inside the zone.
BitmapDataZone
  
invalidate():void
This method forces the zone to revaluate itself.
BitmapDataZone
Property detail
bitmapDataproperty
bitmapData:BitmapData  [read-write]

The bitmapData object that defines the zone.

Implementation
    public function get bitmapData():BitmapData
    public function set bitmapData(value:BitmapData):void
offsetXproperty 
offsetX:Number  [read-write]

A horizontal offset to apply to the pixels in the BitmapData object to reposition the zone

Implementation
    public function get offsetX():Number
    public function set offsetX(value:Number):void
offsetYproperty 
offsetY:Number  [read-write]

A vertical offset to apply to the pixels in the BitmapData object to reposition the zone

Implementation
    public function get offsetY():Number
    public function set offsetY(value:Number):void
scaleXproperty 
scaleX:Number  [read-write]

A scale factor to stretch the bitmap horizontally

Implementation
    public function get scaleX():Number
    public function set scaleX(value:Number):void
scaleYproperty 
scaleY:Number  [read-write]

A scale factor to stretch the bitmap vertically

Implementation
    public function get scaleY():Number
    public function set scaleY(value:Number):void
Constructor detail
BitmapDataZone()constructor
public function BitmapDataZone(bitmapData:BitmapData, offsetX:Number = 0, offsetY:Number = 0, scaleX:Number = 1, scaleY:Number = 1)

The constructor creates a BitmapDataZone object.

Parameters
bitmapData:BitmapData — The bitmapData object that defines the zone.
 
offsetX:Number (default = 0) — A horizontal offset to apply to the pixels in the BitmapData object to reposition the zone
 
offsetY:Number (default = 0) — A vertical offset to apply to the pixels in the BitmapData object to reposition the zone
 
scaleX:Number (default = 1) — A scale factor to stretch the bitmap horizontally
 
scaleY:Number (default = 1) — A scale factor to stretch the bitmap vertically
Method detail
contains()method
public function contains(x:Number, y:Number):Boolean

The contains method determines whether a point is inside the zone.

Parameters
x:Number — The location to test for.
 
y:Number

Returns
Boolean — true if point is inside the zone, false if it is outside.
getArea()method 
public function getArea():Number

The getArea method returns the size of the zone. It's used by the MultiZone class to manage the balancing between the different zones.

Returns
Number — the size of the zone.
getLocation()method 
public function getLocation():Point

The getLocation method returns a random point inside the zone.

Returns
Point — a random point inside the zone.
invalidate()method 
public function invalidate():void

This method forces the zone to revaluate itself. It should be called whenever the contents of the BitmapData object change. However, it is an intensive method and calling it frequently will likely slow your code down.