Packagegraphics.drawing
Classpublic class BubblePen
InheritanceBubblePen Inheritance RoundedComplexRectanglePen Inheritance CornerRectanglePen Inheritance RectanglePen Inheritance Pen Inheritance flash.utils.Proxy

Draws a bubble shape with a custom alignment, offset, corner radius, arrow and size.

Example :

     package examples
     {
         import graphics.Align;
         import graphics.FillStyle;
         import graphics.LineStyle;
         
         import graphics.drawing.BubblePen;
         
         import flash.display.Shape;
         import flash.display.Sprite;
         import flash.display.StageScaleMode;
         import flash.events.KeyboardEvent;
         import flash.ui.Keyboard;
         
         public class ExampleBubblePen extends Sprite
         {
             public function ExampleBubblePen()
             {
                 /////////
                 
                 stage.scaleMode = StageScaleMode.NO_SCALE ;
                 stage.align = "" ;
                 
                 stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
                 
                 /////////
                 
                 var shape:Shape = new Shape() ;
                 
                 shape.x = 740 / 2 ;
                 shape.y = 420 / 2 ;
                 
                 addChild( shape ) ;
                 
                 /////////
                 
                 pen = new BubblePen( shape , 0 , 0, 200, 150, 14, 14, 14 , 14 ) ;
                 
                 pen.arrowHeight = 15 ;
                 pen.arrowWidth  = 15 ;
                 pen.arrowMargin = 20 ; // only when a corner radius is 0
                 
                 pen.align = Align.TOP_RIGHT ;
                 pen.fill  = new FillStyle( 0xFF0000 , 0.5 ) ;
                 pen.line  = new LineStyle( 2, 0xFFFFFF ) ;
                 
                 pen.draw() ;
             }
             
             public var pen:BubblePen ;
             
             public function keyDown( e:KeyboardEvent ):void
             {
                 var code:uint = e.keyCode ;
                 switch( code )
                 {
                     case Keyboard.LEFT :
                     case Keyboard.NUMPAD_6 :
                     {
                         pen.align = Align.LEFT ;
                         break ;
                     }
                     case Keyboard.RIGHT :
                     case Keyboard.NUMPAD_4 :
                     {
                         pen.align = Align.RIGHT ;
                         break ;
                     }
                     case Keyboard.UP :
                     case Keyboard.NUMPAD_2 :
                     {
                         pen.align = Align.TOP ;
                         break ;
                     }
                     case Keyboard.DOWN :
                     case Keyboard.NUMPAD_8 :
                     {
                         pen.align = Align.BOTTOM ;
                         break ;
                     }
                     case Keyboard.SPACE :
                     {
                         pen.align = Align.TOP_LEFT ;
                         break ;
                     }
                     case Keyboard.NUMPAD_7 :
                     {
                         pen.align = Align.BOTTOM_RIGHT ;
                         break ;
                     }
                     case Keyboard.NUMPAD_9 :
                     {
                         pen.align = Align.BOTTOM_LEFT ;
                         break ;
                     }
                     case Keyboard.NUMPAD_1 :
                     {
                         pen.align = Align.TOP_RIGHT ;
                         break ;
                     }
                     case Keyboard.NUMPAD_3 :
                     {
                         pen.align = Align.TOP_LEFT ;
                         break ;
                     }
                 }
                 pen.draw() ;
                 trace( "rectangle area : " + pen.rectangle ) ;
             }
         }
     }
     



Public Properties
 PropertyDefined By
 Inheritedalign : uint
Determinates the align value of the pen.
Pen
  arrowHeight : Number
Determinates the height of the arrow of the bubble.
BubblePen
  arrowMargin : Number
Determinates the margin of the arrow of the bubble.
BubblePen
  arrowWidth : Number
Determinates the margin of the arrow of the bubble.
BubblePen
 InheritedbottomLeftRadius : Number
The radius of the bottom-left corner, in pixels.
RoundedComplexRectanglePen
 InheritedbottomRightRadius : Number
The radius of the bottom-left corner, in pixels.
RoundedComplexRectanglePen
 Inheritedcorner : Corner
Determinates the Corner value of this pen.
CornerRectanglePen
 InheritedcornerRadius : Number
The global corner radius corner, in pixels.
RoundedComplexRectanglePen
 Inheritedfill : IFillStyle
Determinates the fill style object of the pen.
Pen
 Inheritedgraphics : *
Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur.
Pen
 Inheritedheight : Number
Defines the height of the shape rectangle.
RectanglePen
 Inheritedline : ILineStyle
Determinates the line style object of the pen.
Pen
  maximum : Vector2
[read-only] The maximum Vector2 object to defines the bottom right point of the rectangle area in the bubble shape.
BubblePen
  minimum : Vector2
[read-only] The minimum Vector2 object to defines the top left point of the rectangle area in the bubble shape.
BubblePen
  rectangle : Rectangle
[override] [read-only] The Rectangle reference of this pen (use it to defines the rectangle area and not the arrow area of the bubble).
BubblePen
 InheritedtopLeftRadius : Number
The radius of the upper-left corner, in pixels.
RoundedComplexRectanglePen
 InheritedtopRightRadius : Number
The radius of the upper-right corner, in pixels.
RoundedComplexRectanglePen
 InheriteduseClear : Boolean = true
Indicates if the clear() method is invoked at the end of the draw method.
Pen
 InheriteduseEndFill : Boolean = true
Indicates if the endFill() method is invoked at the end of the draw method.
Pen
 Inheritedwidth : Number
Defines the width of the shape rectangle.
RectanglePen
 Inheritedx : Number
Defines the x position of the shape rectangle.
RectanglePen
 Inheritedy : Number
Defines the y position of the shape rectangle.
RectanglePen
Public Methods
 MethodDefined By
  
BubblePen(graphic:*, x:Number = 0, y:Number = 0, width:Number = 0, height:Number = 0, topLeftRadius:Number = 0, topRightRadius:Number = 0, bottomRightRadius:Number = 0, bottomLeftRadius:Number = 0, align:uint = 10)
Creates a new BubblePen instance.
BubblePen
 Inherited
BF(... arguments):void
Defines a shortcut reference to used the beginBitmapFill method.
Pen
 Inherited
C(... arguments):void
Defines a shortcut reference to used the curveTo method.
Pen
 Inherited
CL():void
Defines a shortcut reference to used the clear method.
Pen
 Inherited
draw(... args):void
[override] Draws the shape.
RectanglePen
  
drawShape():void
[override] This method contains the basic drawing shape algorithm.
BubblePen
 Inherited
EF():void
Defines a shortcut reference to used the endFill method.
Pen
 Inherited
F(... arguments):void
Defines a shortcut reference to used the beginFill method.
Pen
 Inherited
GF(... arguments):void
Defines a shortcut reference to used the beginGradientFill method.
Pen
 Inherited
GS(... arguments):void
Defines a shortcut reference to used the lineGradientStyle method.
Pen
 Inherited
L(... arguments):void
Defines a shortcut reference to used the lineTo method.
Pen
 Inherited
M(... arguments):void
Defines a shortcut reference to used the moveTo method.
Pen
 Inherited
S(... arguments):void
Defines a shortcut reference to used the lineStyle method.
Pen
 Inherited
setPen(... args):void
[override] Sets the shape options to defined all values to draw the shape.
RoundedComplexRectanglePen
Protected Methods
 MethodDefined By
 Inherited
Invoked to refresh the offset x and y position defines by the align property.
RectanglePen
Property Detail
arrowHeightproperty
arrowHeight:Number

Determinates the height of the arrow of the bubble.


Implementation
    public function get arrowHeight():Number
    public function set arrowHeight(value:Number):void
arrowMarginproperty 
arrowMargin:Number

Determinates the margin of the arrow of the bubble.


Implementation
    public function get arrowMargin():Number
    public function set arrowMargin(value:Number):void
arrowWidthproperty 
arrowWidth:Number

Determinates the margin of the arrow of the bubble.


Implementation
    public function get arrowWidth():Number
    public function set arrowWidth(value:Number):void
maximumproperty 
maximum:Vector2  [read-only]

The maximum Vector2 object to defines the bottom right point of the rectangle area in the bubble shape.


Implementation
    public function get maximum():Vector2
minimumproperty 
minimum:Vector2  [read-only]

The minimum Vector2 object to defines the top left point of the rectangle area in the bubble shape.


Implementation
    public function get minimum():Vector2
rectangleproperty 
rectangle:Rectangle  [read-only] [override]

The Rectangle reference of this pen (use it to defines the rectangle area and not the arrow area of the bubble). This property change when the draw() method is invoked.


Implementation
    public function get rectangle():Rectangle
Constructor Detail
BubblePen()Constructor
public function BubblePen(graphic:*, x:Number = 0, y:Number = 0, width:Number = 0, height:Number = 0, topLeftRadius:Number = 0, topRightRadius:Number = 0, bottomRightRadius:Number = 0, bottomLeftRadius:Number = 0, align:uint = 10)

Creates a new BubblePen instance.

Parameters
graphic:* — The Graphics reference to control with this helper. You can passed-in a Shape or Sprite/MovieClip reference in argument.
 
x:Number (default = 0) — (optional) The x position of the pen. (default 0)
 
y:Number (default = 0) — (optional) The y position of the pen. (default 0)
 
width:Number (default = 0) — (optional) The width of the pen. (default 0)
 
height:Number (default = 0) — (optional) The height of the pen. (default 0)
 
topLeftRadius:Number (default = 0) — (optional) The radius of the upper-left corner, in pixels. (default 0)
 
topRightRadius:Number (default = 0) — (optional) The radius of the upper-right corner, in pixels. (default 0)
 
bottomRightRadius:Number (default = 0) — (optional) The radius of the bottom-left corner, in pixels. (default 0)
 
bottomLeftRadius:Number (default = 0) — (optional) The radius of the bottom-right corner, in pixels. (default 0)
 
align:uint (default = 10) — (optional) The align value of the pen. (default Align.TOP_LEFT)
Method Detail
drawShape()method
override public function drawShape():void

This method contains the basic drawing shape algorithm.