Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
define("as3/flash/display/Shape",["module","exports","as3-rt/AS3","as3/flash/display/DisplayObject","as3/flash/display/Graphics","as3/flash/display/RenderState"], function($module,$exports,AS3,DisplayObject,Graphics,RenderState) { AS3.compilationUnit($module,$exports,function($primaryDeclaration){/*package flash.display {
import flash.geom.Matrix;
import flash.geom.Rectangle;

import js.CanvasRenderingContext2D;
import js.HTMLCanvasElement;
import js.HTMLElement;

 * This class is used to create lightweight shapes using the ActionScript drawing application program interface (API). The Shape class includes a <code>graphics</code> property, which lets you access methods from the Graphics class.
 * <p>The Sprite class also includes a <code>graphics</code>property, and it includes other features not available to the Shape class. For example, a Sprite object is a display object container, whereas a Shape object is not (and cannot contain child display objects). For this reason, Shape objects consume less memory than Sprite objects that contain the same graphics. However, a Sprite object supports user input events, while a Shape object does not.</p>
 * <p><a href="">View the examples</a></p>
 * @see Graphics
 * @see Sprite
 * @see Core display classes
 * @see Basics of the drawing API
 * /
public class Shape extends DisplayObject {
   * Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur.
   * /
  public*/ function  get$graphics()/*:Graphics*/ {
    return this._graphics$3;

   * Creates a new Shape object.
   * /
  public*/ function Shape() {;
    this._graphics$3 = new Graphics._();

  // ************************** Jangaroo part **************************

  override protected*/ function getBoundsTransformed(matrix/*:Matrix = null*/, resultRectangle/*:Rectangle = null*/)/*:Rectangle*/ {switch(arguments.length){case 0:matrix=null;case 1:resultRectangle=null;}
    return this._graphics$3.getBoundsTransformed(matrix, resultRectangle);

  override protected*/ function _doRender(renderState/*:RenderState*/)/*:void*/ {

  override protected*/ function getElementName()/*:String*/ {
    return 'canvas';

  override protected*/ function updateElement(element/*:HTMLElement*/, bounds/*:Rectangle*/)/*:void*/ {
    this.updateTransform(element, bounds);
    var canvas/*:HTMLCanvasElement*/ =AS3.cast( HTMLCanvasElement,element);
    var context/*:CanvasRenderingContext2D*/ =AS3.cast( CanvasRenderingContext2D,canvas.getContext('2d'));
    RenderState._.resizeAndReset(context, this._graphics$3.width, this._graphics$3.height);

  private var _graphics : Graphics;

============================================== Jangaroo part ==============================================*/
    var Super=DisplayObject._;
    var super$=Super.prototype;
    $primaryDeclaration(AS3.class_($module, {
      extends_: Super,
      members: {
        graphics: {get: get$graphics},
        constructor: Shape,
        getBoundsTransformed: getBoundsTransformed,
        getBoundsTransformed$3: super$.getBoundsTransformed,
        _doRender: _doRender,
        _doRender$3: super$._doRender,
        getElementName: getElementName,
        getElementName$3: super$.getElementName,
        updateElement: updateElement,
        updateElement$3: super$.updateElement,
        _graphics$3: {
          value: null,
          writable: true
New to GrepCode? Check out our FAQ X