Packageorg.flintparticles.twoD.zones
Classpublic class DisplayObjectZone
InheritanceDisplayObjectZone Inheritance Object
Implements Zone2D

The DisplayObjectZone zone defines a shaped zone based on a DisplayObject. The zone contains the shape of the DisplayObject. The DisplayObject must be on the stage for it to be used, since it's position on stage determines the position of the zone.



Public Properties
 PropertyDefined By
  displayObject : DisplayObject
The DisplayObject that defines the zone.
DisplayObjectZone
  renderer : DisplayObject
The emitter that you plan to use the zone with.
DisplayObjectZone
Public Methods
 MethodDefined By
  
DisplayObjectZone(displayObject:DisplayObject = null, renderer:DisplayObject = null)
The constructor creates a DisplayObjectZone object.
DisplayObjectZone
  
collideParticle(particle:Particle2D, bounce:Number = 1):Boolean
Manages collisions between a particle and the zone.
DisplayObjectZone
  
contains(x:Number, y:Number):Boolean
The contains method determines whether a point is inside the zone.
DisplayObjectZone
  
getArea():Number
The getArea method returns the size of the zone.
DisplayObjectZone
  
getLocation():Point
The getLocation method returns a random point inside the zone.
DisplayObjectZone
Property Detail
displayObjectproperty
displayObject:DisplayObject

The DisplayObject that defines the zone.


Implementation
    public function get displayObject():DisplayObject
    public function set displayObject(value:DisplayObject):void
rendererproperty 
renderer:DisplayObject

The emitter that you plan to use the zone with. The coordinates of the DisplayObject are translated to the local coordinate space of the emitter.


Implementation
    public function get renderer():DisplayObject
    public function set renderer(value:DisplayObject):void
Constructor Detail
DisplayObjectZone()Constructor
public function DisplayObjectZone(displayObject:DisplayObject = null, renderer:DisplayObject = null)

The constructor creates a DisplayObjectZone object.

Parameters
displayObject:DisplayObject (default = null) — The DisplayObject that defines the zone.
 
renderer:DisplayObject (default = null) — The renderer that you plan to use the zone with. The coordinates of the DisplayObject are translated to the local coordinate space of the renderer.
Method Detail
collideParticle()method
public function collideParticle(particle:Particle2D, bounce:Number = 1):Boolean

Manages collisions between a particle and the zone. The particle will collide with the edges of the zone, from the inside or outside. In the interests of speed, these collisions do not take account of the collisionRadius of the particle and they do not calculate an accurate bounce direction from the shape of the zone. Priority is placed on keeping particles inside or outside the zone.

Parameters

particle:Particle2D — The particle to be tested for collision with the zone.
 
bounce:Number (default = 1) — The coefficient of restitution for the collision.

Returns
Boolean — Whether a collision occured.
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.