Packagecom.pcthomatos.utilities
Classpublic class SpriteRegPoint
InheritanceSpriteRegPoint Inheritance flash.display.Sprite

A Sprite wrapper class that allows one to programatically set a registration point on a display object without the use of the flash IDE.
Options:
Usage:
            var squareBox:Sprite = new Sprite();
            squareBox.graphics.beginFill(0xFF0000);
            squareBox.graphics.drawRect(0,0,100,100);

            var centeredSprite:Sprite = new SpriteRegPoint("C");
            centeredSprite.addChild(squareBox);
            addChild(centeredSprite);
            centeredSprite.rotation = 45;
     



Public Properties
 PropertyDefined by
  graphics : Graphics
[read-only]
SpriteRegPoint
  numChildren : int
[read-only]
SpriteRegPoint
Public Methods
 MethodDefined by
  
SpriteRegPoint(registrationPoint:String = null, xReg:Number, yReg:Number)
If the registrationPoint parameter is set, sets a registration point similar to the way it is set in the flash ide.
SpriteRegPoint
  
addChild(child:DisplayObject):DisplayObject
SpriteRegPoint
  
addChildAt(child:DisplayObject, index:int):DisplayObject
SpriteRegPoint
  
contains(child:DisplayObject):Boolean
SpriteRegPoint
  
getChildAt(index:int):DisplayObject
SpriteRegPoint
  
getChildByName(name:String):DisplayObject
SpriteRegPoint
  
getChildIndex(child:DisplayObject):int
SpriteRegPoint
  
removeChild(child:DisplayObject):DisplayObject
SpriteRegPoint
  
removeChildAt(index:int):DisplayObject
SpriteRegPoint
  
setChildIndex(child:DisplayObject, index:int):void
SpriteRegPoint
  
setRegistrationCoords(xReg:int, yReg:int):void
Sets X,Y registration coordinates.
SpriteRegPoint
  
setRegistrationPoint(registrationPoint:String):void
Sets a registration point similar to the way it is set in the flash ide.
SpriteRegPoint
  
swapChildren(child1:DisplayObject, child2:DisplayObject):void
SpriteRegPoint
  
swapChildrenAt(index1:int, index2:int):void
SpriteRegPoint
  
When using graphics classes call this after you're done drawing to update the registration point.
SpriteRegPoint
Property detail
graphicsproperty
graphics:Graphics  [read-only]

Implementation
    public function get graphics():Graphics
numChildrenproperty 
numChildren:int  [read-only]

Implementation
    public function get numChildren():int
Constructor detail
SpriteRegPoint()constructor
public function SpriteRegPoint(registrationPoint:String = null, xReg:Number, yReg:Number)

If the registrationPoint parameter is set, sets a registration point similar to the way it is set in the flash ide.
If xReg and yReg, sets X,Y registration coordinates. Does not auto update, since hardcoded coordinates are used.
Note: When using graphics classes call this after you're done drawing, call updateRegistrationPoint to update the registration point.

Parameters
registrationPoint:String (default = null) — - Options are "TL", "TC", "TR", "CL", "C", "CR", "BL", "BC", and "BR"
 
xReg:Number — - x registration point coordinate
 
yReg:Number — - y registration point coordinate
Method detail
addChild()method
public override function addChild(child:DisplayObject):DisplayObject

Parameters
child:DisplayObject

Returns
DisplayObject
addChildAt()method 
public override function addChildAt(child:DisplayObject, index:int):DisplayObject

Parameters
child:DisplayObject
 
index:int

Returns
DisplayObject
contains()method 
public override function contains(child:DisplayObject):Boolean

Parameters
child:DisplayObject

Returns
Boolean
getChildAt()method 
public override function getChildAt(index:int):DisplayObject

Parameters
index:int

Returns
DisplayObject
getChildByName()method 
public override function getChildByName(name:String):DisplayObject

Parameters
name:String

Returns
DisplayObject
getChildIndex()method 
public override function getChildIndex(child:DisplayObject):int

Parameters
child:DisplayObject

Returns
int
removeChild()method 
public override function removeChild(child:DisplayObject):DisplayObject

Parameters
child:DisplayObject

Returns
DisplayObject
removeChildAt()method 
public override function removeChildAt(index:int):DisplayObject

Parameters
index:int

Returns
DisplayObject
setChildIndex()method 
public override function setChildIndex(child:DisplayObject, index:int):void

Parameters
child:DisplayObject
 
index:int
setRegistrationCoords()method 
public function setRegistrationCoords(xReg:int, yReg:int):void

Sets X,Y registration coordinates. Does not auto update, since hardcoded coordinates are used.

Parameters
xReg:int — - x registration point coordinate
 
yReg:int — - y registration point coordinate
setRegistrationPoint()method 
public function setRegistrationPoint(registrationPoint:String):void

Sets a registration point similar to the way it is set in the flash ide.

Parameters
registrationPoint:String — Options are "TL", "TC", "TR", "CL", "C", "CR", "BL", "BC", and "BR"
swapChildren()method 
public override function swapChildren(child1:DisplayObject, child2:DisplayObject):void

Parameters
child1:DisplayObject
 
child2:DisplayObject
swapChildrenAt()method 
public override function swapChildrenAt(index1:int, index2:int):void

Parameters
index1:int
 
index2:int
updateRegistrationPoint()method 
public function updateRegistrationPoint():void

When using graphics classes call this after you're done drawing to update the registration point.