Packagecom.nocircleno.graffiti.tools
Classpublic class ShapeTool
InheritanceShapeTool Inheritance Object
Implements ITool

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10 - AIR 1.5

ShapeTool Class allows the user to draw RECTANGLE, SQUARE, OVAL or CIRCLE to the canvas. You can control the stroke and fill of the shape.



Public Properties
 PropertyDefined By
  fillAlpha : Number
ShapeTool
  fillColor : int
ShapeTool
  mode : String
ShapeTool
  renderType : String
[read-only] Shape Render Mode
ShapeTool
  strokeAlpha : Number
ShapeTool
  strokeColor : int
ShapeTool
  strokeWidth : Number
ShapeTool
  type : String
ShapeTool
Public Methods
 MethodDefined By
  
ShapeTool(strokeWidth:Number = 1, strokeColor:int = 0x000000, fillColor:int = 0xFFFFFF, strokeAlpha:Number = 1, fillAlpha:Number = 1, shapeType:String = null, toolMode:String = null)
The ShapeTool constructor.
ShapeTool
  
apply(drawingTarget:DisplayObject, point1:Point, point2:Point = null):void
The apply method applies the line to the Sprite object passed to the method.
ShapeTool
  
resetTool():void
The resetTool method will clear the drawing commands and data.
ShapeTool
Property Detail
fillAlphaproperty
fillAlpha:Number  [read-write]


Implementation
    public function get fillAlpha():Number
    public function set fillAlpha(value:Number):void
fillColorproperty 
fillColor:int  [read-write]


Implementation
    public function get fillColor():int
    public function set fillColor(value:int):void
modeproperty 
mode:String  [read-write]


Implementation
    public function get mode():String
    public function set mode(value:String):void
renderTypeproperty 
renderType:String  [read-only]

Shape Render Mode


Implementation
    public function get renderType():String
strokeAlphaproperty 
strokeAlpha:Number  [read-write]


Implementation
    public function get strokeAlpha():Number
    public function set strokeAlpha(value:Number):void
strokeColorproperty 
strokeColor:int  [read-write]


Implementation
    public function get strokeColor():int
    public function set strokeColor(value:int):void
strokeWidthproperty 
strokeWidth:Number  [read-write]


Implementation
    public function get strokeWidth():Number
    public function set strokeWidth(value:Number):void
typeproperty 
type:String  [read-write]


Implementation
    public function get type():String
    public function set type(value:String):void
Constructor Detail
ShapeTool()Constructor
public function ShapeTool(strokeWidth:Number = 1, strokeColor:int = 0x000000, fillColor:int = 0xFFFFFF, strokeAlpha:Number = 1, fillAlpha:Number = 1, shapeType:String = null, toolMode:String = null)

The ShapeTool constructor.

Parameters
strokeWidth:Number (default = 1) — Stroke width.
 
strokeColor:int (default = 0x000000) — Stroke Color, pass -1 for NO stroke on Shape.
 
fillColor:int (default = 0xFFFFFF) — Fill Color, pass -1 for NO fill in Shape.
 
strokeAlpha:Number (default = 1) — Stroke Alpha, default is 1.
 
fillAlpha:Number (default = 1) — Fill Alpha, default is 1.
 
shapeType:String (default = null) — Type of Shape.
 
toolMode:String (default = null) — Tool mode the Shape will be drawing with.

Example
The following code creates a Shape instance.
        // create a rectangle shape with red stroke width of 2 and no fill
        var rectangleShape:Shape = new Shape(2, 0xFF0000, -1, 1, 1, ShapeType.RECTANGLE);
        
Method Detail
apply()method
public function apply(drawingTarget:DisplayObject, point1:Point, point2:Point = null):void

The apply method applies the line to the Sprite object passed to the method.

Parameters

drawingTarget:DisplayObject — Sprite that the Shape will draw to.
 
point1:Point — Starting point to apply Shape.
 
point2:Point (default = null) — End point to apply Shape.

resetTool()method 
public function resetTool():void

The resetTool method will clear the drawing commands and data. This is used by the GraffitiCanvas after the Mouse has been released.