all repos — simplyrpg @ 22e7c7bea11f4bc81b76acd3c35138615dc759ee

Fork of https://github.com/harperd1/simplyRPG — multi-map VTT, token visibility, dark theme, stream HUD

libraries/EaselJS_docs/files/easeljs_display_DisplayObject.js.html (view raw)

   1<!DOCTYPE html>
   2<html lang="en">
   3<head>
   4    <meta charset="utf-8">
   5    <link rel="stylesheet" href="../assets/css/yui-cssgrids-min.css">
   6    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
   7    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
   8    <link rel="shortcut icon" type="image/x-icon" href="../assets/favicon.ico">
   9    <script src="../assets/js/yui-source.js"></script>
  10	<title>EaselJS v1.0.0 API Documentation : easeljs/display/DisplayObject.js</title>
  11</head>
  12<body class="yui3-skin-sam">
  13
  14<div id="doc">
  15    <div id="hd" class="yui3-g header">
  16        <div class="yui3-u-3-4">
  17            
  18                <h1><a href="http://www.createjs.com/easeljs"><img src="../assets/docs-icon-EaselJS.png" title="EaselJS"></a></h1>
  19            
  20        </div>
  21        <div class="version">
  22            <em>API Documentation for: 1.0.0</em>
  23        </div>
  24    </div>
  25    <div id="bd" class="yui3-g">
  26
  27        <div class="yui3-u-1-4">
  28            <div id="docs-sidebar" class="sidebar apidocs">
  29                <div id="api-list">
  30    <h2 class="off-left">APIs</h2>
  31    <div id="api-tabview" class="tabview">
  32        <ul class="tabs">
  33            <li><a href="#api-classes">Classes</a></li>
  34        </ul>
  35
  36        <div id="api-tabview-filter">
  37            <input type="search" id="api-filter" placeholder="Type to filter APIs">
  38        </div>
  39
  40        <div id="api-tabview-panel">
  41            <ul id="api-classes" class="apis classes">
  42            
  43                <li><a href="../classes/AlphaMapFilter.html">AlphaMapFilter</a></li>
  44            
  45                <li><a href="../classes/AlphaMaskFilter.html">AlphaMaskFilter</a></li>
  46            
  47                <li><a href="../classes/Bitmap.html">Bitmap</a></li>
  48            
  49                <li><a href="../classes/BitmapCache.html">BitmapCache</a></li>
  50            
  51                <li><a href="../classes/BitmapText.html">BitmapText</a></li>
  52            
  53                <li><a href="../classes/BlurFilter.html">BlurFilter</a></li>
  54            
  55                <li><a href="../classes/ButtonHelper.html">ButtonHelper</a></li>
  56            
  57                <li><a href="../classes/ColorFilter.html">ColorFilter</a></li>
  58            
  59                <li><a href="../classes/ColorMatrix.html">ColorMatrix</a></li>
  60            
  61                <li><a href="../classes/ColorMatrixFilter.html">ColorMatrixFilter</a></li>
  62            
  63                <li><a href="../classes/Container.html">Container</a></li>
  64            
  65                <li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
  66            
  67                <li><a href="../classes/DisplayProps.html">DisplayProps</a></li>
  68            
  69                <li><a href="../classes/DOMElement.html">DOMElement</a></li>
  70            
  71                <li><a href="../classes/EaselJS.html">EaselJS</a></li>
  72            
  73                <li><a href="../classes/Event.html">Event</a></li>
  74            
  75                <li><a href="../classes/EventDispatcher.html">EventDispatcher</a></li>
  76            
  77                <li><a href="../classes/Filter.html">Filter</a></li>
  78            
  79                <li><a href="../classes/Graphics.html">Graphics</a></li>
  80            
  81                <li><a href="../classes/Graphics.Arc.html">Graphics.Arc</a></li>
  82            
  83                <li><a href="../classes/Graphics.ArcTo.html">Graphics.ArcTo</a></li>
  84            
  85                <li><a href="../classes/Graphics.BeginPath.html">Graphics.BeginPath</a></li>
  86            
  87                <li><a href="../classes/Graphics.BezierCurveTo.html">Graphics.BezierCurveTo</a></li>
  88            
  89                <li><a href="../classes/Graphics.Circle.html">Graphics.Circle</a></li>
  90            
  91                <li><a href="../classes/Graphics.ClosePath.html">Graphics.ClosePath</a></li>
  92            
  93                <li><a href="../classes/Graphics.Ellipse.html">Graphics.Ellipse</a></li>
  94            
  95                <li><a href="../classes/Graphics.Fill.html">Graphics.Fill</a></li>
  96            
  97                <li><a href="../classes/Graphics.LineTo.html">Graphics.LineTo</a></li>
  98            
  99                <li><a href="../classes/Graphics.MoveTo.html">Graphics.MoveTo</a></li>
 100            
 101                <li><a href="../classes/Graphics.PolyStar.html">Graphics.PolyStar</a></li>
 102            
 103                <li><a href="../classes/Graphics.QuadraticCurveTo.html">Graphics.QuadraticCurveTo</a></li>
 104            
 105                <li><a href="../classes/Graphics.Rect.html">Graphics.Rect</a></li>
 106            
 107                <li><a href="../classes/Graphics.RoundRect.html">Graphics.RoundRect</a></li>
 108            
 109                <li><a href="../classes/Graphics.Stroke.html">Graphics.Stroke</a></li>
 110            
 111                <li><a href="../classes/Graphics.StrokeDash.html">Graphics.StrokeDash</a></li>
 112            
 113                <li><a href="../classes/Graphics.StrokeStyle.html">Graphics.StrokeStyle</a></li>
 114            
 115                <li><a href="../classes/Matrix2D.html">Matrix2D</a></li>
 116            
 117                <li><a href="../classes/MouseEvent.html">MouseEvent</a></li>
 118            
 119                <li><a href="../classes/MovieClip.html">MovieClip</a></li>
 120            
 121                <li><a href="../classes/MovieClipPlugin.html">MovieClipPlugin</a></li>
 122            
 123                <li><a href="../classes/Point.html">Point</a></li>
 124            
 125                <li><a href="../classes/Rectangle.html">Rectangle</a></li>
 126            
 127                <li><a href="../classes/Shadow.html">Shadow</a></li>
 128            
 129                <li><a href="../classes/Shape.html">Shape</a></li>
 130            
 131                <li><a href="../classes/Sprite.html">Sprite</a></li>
 132            
 133                <li><a href="../classes/SpriteSheet.html">SpriteSheet</a></li>
 134            
 135                <li><a href="../classes/SpriteSheetBuilder.html">SpriteSheetBuilder</a></li>
 136            
 137                <li><a href="../classes/SpriteSheetUtils.html">SpriteSheetUtils</a></li>
 138            
 139                <li><a href="../classes/Stage.html">Stage</a></li>
 140            
 141                <li><a href="../classes/StageGL.html">StageGL</a></li>
 142            
 143                <li><a href="../classes/Text.html">Text</a></li>
 144            
 145                <li><a href="../classes/Ticker.html">Ticker</a></li>
 146            
 147                <li><a href="../classes/Touch.html">Touch</a></li>
 148            
 149                <li><a href="../classes/UID.html">UID</a></li>
 150            
 151                <li><a href="../classes/Utility Methods.html">Utility Methods</a></li>
 152            
 153                <li><a href="../classes/VideoBuffer.html">VideoBuffer</a></li>
 154            
 155                <li><a href="../classes/WebGLInspector.html">WebGLInspector</a></li>
 156            
 157            </ul>
 158
 159            <ul id="api-modules" class="apis modules">
 160            
 161                <li><a href="../modules/CreateJS.html">CreateJS</a></li>
 162            
 163                <li><a href="../modules/EaselJS.html">EaselJS</a></li>
 164            
 165            </ul>
 166        </div>
 167    </div>
 168</div>
 169
 170            </div>
 171        </div>
 172        <div class="yui3-u-3-4">
 173            <div id="api-options">
 174        Show:
 175        <label for="api-show-inherited">
 176            <input type="checkbox" id="api-show-inherited" checked>
 177            Inherited
 178        </label>
 179
 180        <label for="api-show-protected">
 181            <input type="checkbox" id="api-show-protected">
 182            Protected
 183        </label>
 184
 185        <label for="api-show-private">
 186            <input type="checkbox" id="api-show-private">
 187            Private
 188        </label>
 189        <label for="api-show-deprecated">
 190            <input type="checkbox" id="api-show-deprecated">
 191            Deprecated
 192        </label>
 193
 194    </div>
 195            <div class="apidocs">
 196                <div id="docs-main">
 197                    <div class="content source-content">
 198                        <script>
 199	var name = easeljs/display/DisplayObject.js      
 200</script>
 201<h1 class="file-heading">File:DisplayObject.js</h1>
 202
 203<div class="file">
 204    <pre class="code prettyprint linenums">
 205/*
 206* DisplayObject
 207* Visit http://createjs.com/ for documentation, updates and examples.
 208*
 209* Copyright (c) 2010 gskinner.com, inc.
 210* 
 211* Permission is hereby granted, free of charge, to any person
 212* obtaining a copy of this software and associated documentation
 213* files (the &quot;Software&quot;), to deal in the Software without
 214* restriction, including without limitation the rights to use,
 215* copy, modify, merge, publish, distribute, sublicense, and/or sell
 216* copies of the Software, and to permit persons to whom the
 217* Software is furnished to do so, subject to the following
 218* conditions:
 219* 
 220* The above copyright notice and this permission notice shall be
 221* included in all copies or substantial portions of the Software.
 222* 
 223* THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
 224* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 225* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 226* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 227* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 228* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 229* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 230* OTHER DEALINGS IN THE SOFTWARE.
 231*/
 232
 233/**
 234 * The EaselJS Javascript library provides a retained graphics mode for canvas including a full hierarchical display
 235 * list, a core interaction model, and helper classes to make working with 2D graphics in Canvas much easier.
 236 * EaselJS provides straight forward solutions for working with rich graphics and interactivity with HTML5 Canvas...
 237 *
 238 * &lt;h4&gt;Getting Started&lt;/h4&gt;
 239 * To get started with Easel, create a {{#crossLink &quot;Stage&quot;}}{{/crossLink}} that wraps a CANVAS element, and add
 240 * {{#crossLink &quot;DisplayObject&quot;}}{{/crossLink}} instances as children. EaselJS supports:
 241 * &lt;ul&gt;
 242 *      &lt;li&gt;Images using {{#crossLink &quot;Bitmap&quot;}}{{/crossLink}}&lt;/li&gt;
 243 *      &lt;li&gt;Vector graphics using {{#crossLink &quot;Shape&quot;}}{{/crossLink}} and {{#crossLink &quot;Graphics&quot;}}{{/crossLink}}&lt;/li&gt;
 244 *      &lt;li&gt;Animated bitmaps using {{#crossLink &quot;SpriteSheet&quot;}}{{/crossLink}} and {{#crossLink &quot;Sprite&quot;}}{{/crossLink}}
 245 *      &lt;li&gt;Simple text instances using {{#crossLink &quot;Text&quot;}}{{/crossLink}}&lt;/li&gt;
 246 *      &lt;li&gt;Containers that hold other DisplayObjects using {{#crossLink &quot;Container&quot;}}{{/crossLink}}&lt;/li&gt;
 247 *      &lt;li&gt;Control HTML DOM elements using {{#crossLink &quot;DOMElement&quot;}}{{/crossLink}}&lt;/li&gt;
 248 * &lt;/ul&gt;
 249 *
 250 * All display objects can be added to the stage as children, or drawn to a canvas directly.
 251 *
 252 * &lt;b&gt;User Interactions&lt;/b&gt;&lt;br /&gt;
 253 * All display objects on stage (except DOMElement) will dispatch events when interacted with using a mouse or
 254 * touch. EaselJS supports hover, press, and release events, as well as an easy-to-use drag-and-drop model. Check out
 255 * {{#crossLink &quot;MouseEvent&quot;}}{{/crossLink}} for more information.
 256 *
 257 * &lt;h4&gt;Simple Example&lt;/h4&gt;
 258 * This example illustrates how to create and position a {{#crossLink &quot;Shape&quot;}}{{/crossLink}} on the {{#crossLink &quot;Stage&quot;}}{{/crossLink}}
 259 * using EaselJS&#x27; drawing API.
 260 *
 261 *	    //Create a stage by getting a reference to the canvas
 262 *	    stage = new createjs.Stage(&quot;demoCanvas&quot;);
 263 *	    //Create a Shape DisplayObject.
 264 *	    circle = new createjs.Shape();
 265 *	    circle.graphics.beginFill(&quot;red&quot;).drawCircle(0, 0, 40);
 266 *	    //Set position of Shape instance.
 267 *	    circle.x = circle.y = 50;
 268 *	    //Add Shape instance to stage display list.
 269 *	    stage.addChild(circle);
 270 *	    //Update stage will render next frame
 271 *	    stage.update();
 272 *
 273 * &lt;b&gt;Simple Interaction Example&lt;/b&gt;&lt;br&gt;
 274 *
 275 *      displayObject.addEventListener(&quot;click&quot;, handleClick);
 276 *      function handleClick(event){
 277 *          // Click happenened
 278 *      }
 279 *
 280 *      displayObject.addEventListener(&quot;mousedown&quot;, handlePress);
 281 *      function handlePress(event) {
 282 *          // A mouse press happened.
 283 *          // Listen for mouse move while the mouse is down:
 284 *          event.addEventListener(&quot;mousemove&quot;, handleMove);
 285 *      }
 286 *      function handleMove(event) {
 287 *          // Check out the DragAndDrop example in GitHub for more
 288 *      }
 289 *
 290 * &lt;b&gt;Simple Animation Example&lt;/b&gt;&lt;br /&gt;
 291 * This example moves the shape created in the previous demo across the screen.
 292 *
 293 *	    //Update stage will render next frame
 294 *	    createjs.Ticker.addEventListener(&quot;tick&quot;, handleTick);
 295 *
 296 *	    function handleTick() {
 297 *          //Circle will move 10 units to the right.
 298 *	    	circle.x += 10;
 299 *	    	//Will cause the circle to wrap back
 300 * 	    	if (circle.x &gt; stage.canvas.width) { circle.x = 0; }
 301 *	    	stage.update();
 302 *	    }
 303 *
 304 * &lt;h4&gt;Other Features&lt;/h4&gt;
 305 * EaselJS also has built in support for
 306 * &lt;ul&gt;&lt;li&gt;Canvas features such as {{#crossLink &quot;Shadow&quot;}}{{/crossLink}} and CompositeOperation&lt;/li&gt;
 307 *      &lt;li&gt;{{#crossLink &quot;Ticker&quot;}}{{/crossLink}}, a global heartbeat that objects can subscribe to&lt;/li&gt;
 308 *      &lt;li&gt;Filters, including a provided {{#crossLink &quot;ColorMatrixFilter&quot;}}{{/crossLink}}, {{#crossLink &quot;AlphaMaskFilter&quot;}}{{/crossLink}},
 309 *      {{#crossLink &quot;AlphaMapFilter&quot;}}{{/crossLink}}, and {{#crossLink &quot;BlurFilter&quot;}}{{/crossLink}}. See {{#crossLink &quot;Filter&quot;}}{{/crossLink}}
 310 *      for more information&lt;/li&gt;
 311 *      &lt;li&gt;A {{#crossLink &quot;ButtonHelper&quot;}}{{/crossLink}} utility, to easily create interactive buttons&lt;/li&gt;
 312 *      &lt;li&gt;{{#crossLink &quot;SpriteSheetUtils&quot;}}{{/crossLink}} and a {{#crossLink &quot;SpriteSheetBuilder&quot;}}{{/crossLink}} to
 313 *      help build and manage {{#crossLink &quot;SpriteSheet&quot;}}{{/crossLink}} functionality at run-time.&lt;/li&gt;
 314 * &lt;/ul&gt;
 315 *
 316 * &lt;h4&gt;Browser Support&lt;/h4&gt;
 317 * All modern browsers that support Canvas will support EaselJS (&lt;a href=&quot;http://caniuse.com/canvas&quot;&gt;http://caniuse.com/canvas&lt;/a&gt;).
 318 * Browser performance may vary between platforms, for example, Android Canvas has poor hardware support, and is much
 319 * slower on average than most other browsers.
 320 *
 321 * @module EaselJS
 322 * @main EaselJS
 323 */
 324
 325// namespace:
 326this.createjs = this.createjs||{};
 327
 328(function() {
 329	&quot;use strict&quot;;
 330
 331
 332// constructor:
 333	/**
 334	 * DisplayObject is an abstract class that should not be constructed directly. Instead construct subclasses such as
 335	 * {{#crossLink &quot;Container&quot;}}{{/crossLink}}, {{#crossLink &quot;Bitmap&quot;}}{{/crossLink}}, and {{#crossLink &quot;Shape&quot;}}{{/crossLink}}.
 336	 * DisplayObject is the base class for all display classes in the EaselJS library. It defines the core properties and
 337	 * methods that are shared between all display objects, such as transformation properties (x, y, scaleX, scaleY, etc),
 338	 * caching, and mouse handlers.
 339	 * @class DisplayObject
 340	 * @extends EventDispatcher
 341	 * @constructor
 342	 **/
 343	function DisplayObject() {
 344		this.EventDispatcher_constructor();
 345
 346
 347	// public properties:
 348		/**
 349		 * The alpha (transparency) for this display object. 0 is fully transparent, 1 is fully opaque.
 350		 * @property alpha
 351		 * @type {Number}
 352		 * @default 1
 353		 **/
 354		this.alpha = 1;
 355
 356		/**
 357		 * If a cache is active, this returns the canvas that holds the image of this display object. See {{#crossLink &quot;DisplayObject/cache:method&quot;}}{{/crossLink}}
 358		 * for more information. Use this to display the result of a cache. This will be a HTMLCanvasElement unless special cache rules have been deliberately enabled for this cache.
 359		 * @property cacheCanvas
 360		 * @type {HTMLCanvasElement | Object}
 361		 * @default null
 362		 * @readonly
 363		 **/
 364		this.cacheCanvas = null;
 365
 366		/**
 367		 * If a cache has been made, this returns the class that is managing the cacheCanvas and its properties. See {{#crossLink &quot;BitmapCache&quot;}}{{/crossLink}}
 368		 * for more information. Use this to control, inspect, and change the cache. In special circumstances this may be a modified or subclassed BitmapCache.
 369		 * @property bitmapCache
 370		 * @type {BitmapCache}
 371		 * @default null
 372		 * @readonly
 373		 **/
 374		this.bitmapCache = null;
 375
 376		/**
 377		 * Unique ID for this display object. Makes display objects easier for some uses.
 378		 * @property id
 379		 * @type {Number}
 380		 * @default -1
 381		 **/
 382		this.id = createjs.UID.get();
 383
 384		/**
 385		 * Indicates whether to include this object when running mouse interactions. Setting this to &#x60;false&#x60; for children
 386		 * of a {{#crossLink &quot;Container&quot;}}{{/crossLink}} will cause events on the Container to not fire when that child is
 387		 * clicked. Setting this property to &#x60;false&#x60; does not prevent the {{#crossLink &quot;Container/getObjectsUnderPoint&quot;}}{{/crossLink}}
 388		 * method from returning the child.
 389		 *
 390		 * &lt;strong&gt;Note:&lt;/strong&gt; In EaselJS 0.7.0, the mouseEnabled property will not work properly with nested Containers. Please
 391		 * check out the latest NEXT version in &lt;a href=&quot;https://github.com/CreateJS/EaselJS/tree/master/lib&quot;&gt;GitHub&lt;/a&gt; for an updated version with this issue resolved. The fix will be
 392		 * provided in the next release of EaselJS.
 393		 * @property mouseEnabled
 394		 * @type {Boolean}
 395		 * @default true
 396		 **/
 397		this.mouseEnabled = true;
 398
 399		/**
 400		 * If false, the tick will not run on this display object (or its children). This can provide some performance benefits.
 401		 * In addition to preventing the &quot;tick&quot; event from being dispatched, it will also prevent tick related updates
 402		 * on some display objects (ex. Sprite &amp; MovieClip frame advancing, and DOMElement display properties).
 403		 * @property tickEnabled
 404		 * @type Boolean
 405		 * @default true
 406		 **/
 407		this.tickEnabled = true;
 408
 409		/**
 410		 * An optional name for this display object. Included in {{#crossLink &quot;DisplayObject/toString&quot;}}{{/crossLink}} . Useful for
 411		 * debugging.
 412		 * @property name
 413		 * @type {String}
 414		 * @default null
 415		 **/
 416		this.name = null;
 417
 418		/**
 419		 * A reference to the {{#crossLink &quot;Container&quot;}}{{/crossLink}} or {{#crossLink &quot;Stage&quot;}}{{/crossLink}} object that
 420		 * contains this display object, or null if it has not been added
 421		 * to one.
 422		 * @property parent
 423		 * @final
 424		 * @type {Container}
 425		 * @default null
 426		 * @readonly
 427		 **/
 428		this.parent = null;
 429
 430		/**
 431		 * The left offset for this display object&#x27;s registration point. For example, to make a 100x100px Bitmap rotate
 432		 * around its center, you would set regX and {{#crossLink &quot;DisplayObject/regY:property&quot;}}{{/crossLink}} to 50.
 433		 * Cached object&#x27;s registration points should be set based on pre-cache conditions, not cached size.
 434		 * @property regX
 435		 * @type {Number}
 436		 * @default 0
 437		 **/
 438		this.regX = 0;
 439
 440		/**
 441		 * The y offset for this display object&#x27;s registration point. For example, to make a 100x100px Bitmap rotate around
 442		 * its center, you would set {{#crossLink &quot;DisplayObject/regX:property&quot;}}{{/crossLink}} and regY to 50.
 443		 * Cached object&#x27;s registration points should be set based on pre-cache conditions, not cached size.
 444		 * @property regY
 445		 * @type {Number}
 446		 * @default 0
 447		 **/
 448		this.regY = 0;
 449
 450		/**
 451		 * The rotation in degrees for this display object.
 452		 * @property rotation
 453		 * @type {Number}
 454		 * @default 0
 455		 **/
 456		this.rotation = 0;
 457
 458		/**
 459		 * The factor to stretch this display object horizontally. For example, setting scaleX to 2 will stretch the display
 460		 * object to twice its nominal width. To horizontally flip an object, set the scale to a negative number.
 461		 * @property scaleX
 462		 * @type {Number}
 463		 * @default 1
 464		 **/
 465		this.scaleX = 1;
 466
 467		/**
 468		 * The factor to stretch this display object vertically. For example, setting scaleY to 0.5 will stretch the display
 469		 * object to half its nominal height. To vertically flip an object, set the scale to a negative number.
 470		 * @property scaleY
 471		 * @type {Number}
 472		 * @default 1
 473		 **/
 474		this.scaleY = 1;
 475
 476		/**
 477		 * The factor to skew this display object horizontally.
 478		 * @property skewX
 479		 * @type {Number}
 480		 * @default 0
 481		 **/
 482		this.skewX = 0;
 483
 484		/**
 485		 * The factor to skew this display object vertically.
 486		 * @property skewY
 487		 * @type {Number}
 488		 * @default 0
 489		 **/
 490		this.skewY = 0;
 491
 492		/**
 493		 * A shadow object that defines the shadow to render on this display object. Set to &#x60;null&#x60; to remove a shadow. If
 494		 * null, this property is inherited from the parent container.
 495		 * @property shadow
 496		 * @type {Shadow}
 497		 * @default null
 498		 **/
 499		this.shadow = null;
 500
 501		/**
 502		 * Indicates whether this display object should be rendered to the canvas and included when running the Stage
 503		 * {{#crossLink &quot;Stage/getObjectsUnderPoint&quot;}}{{/crossLink}} method.
 504		 * @property visible
 505		 * @type {Boolean}
 506		 * @default true
 507		 **/
 508		this.visible = true;
 509
 510		/**
 511		 * The x (horizontal) position of the display object, relative to its parent.
 512		 * @property x
 513		 * @type {Number}
 514		 * @default 0
 515		 **/
 516		this.x = 0;
 517
 518		/** The y (vertical) position of the display object, relative to its parent.
 519		 * @property y
 520		 * @type {Number}
 521		 * @default 0
 522		 **/
 523		this.y = 0;
 524
 525		/**
 526		 * If set, defines the transformation for this display object, overriding all other transformation properties
 527		 * (x, y, rotation, scale, skew).
 528		 * @property transformMatrix
 529		 * @type {Matrix2D}
 530		 * @default null
 531		 **/
 532		this.transformMatrix = null;
 533
 534		/**
 535		 * The composite operation indicates how the pixels of this display object will be composited with the elements
 536		 * behind it. If &#x60;null&#x60;, this property is inherited from the parent container. For more information, read the
 537		 * &lt;a href=&quot;https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-globalcompositeoperation&quot;&gt;
 538		 * whatwg spec on compositing&lt;/a&gt;. For a list of supported compositeOperation value, visit
 539		 * &lt;a href=&quot;https://drafts.fxtf.org/compositing/&quot;&gt;the W3C draft on Compositing and Blending&lt;/a&gt;.
 540		 * @property compositeOperation
 541		 * @type {String}
 542		 * @default null
 543		 **/
 544		this.compositeOperation = null;
 545
 546		/**
 547		 * Indicates whether the display object should be drawn to a whole pixel when
 548		 * {{#crossLink &quot;Stage/snapToPixelEnabled&quot;}}{{/crossLink}} is true. To enable/disable snapping on whole
 549		 * categories of display objects, set this value on the prototype (Ex. Text.prototype.snapToPixel = true).
 550		 * @property snapToPixel
 551		 * @type {Boolean}
 552		 * @default true
 553		 **/
 554		this.snapToPixel = true;
 555
 556		/**
 557		 * An array of Filter objects to apply to this display object. Filters are only applied / updated when {{#crossLink &quot;cache&quot;}}{{/crossLink}}
 558		 * or {{#crossLink &quot;updateCache&quot;}}{{/crossLink}} is called on the display object, and only apply to the area that is
 559		 * cached.
 560		 * @property filters
 561		 * @type {Array}
 562		 * @default null
 563		 **/
 564		this.filters = null;
 565
 566		/**
 567		 * A Shape instance that defines a vector mask (clipping path) for this display object.  The shape&#x27;s transformation
 568		 * will be applied relative to the display object&#x27;s parent coordinates (as if it were a child of the parent).
 569		 * @property mask
 570		 * @type {Shape}
 571		 * @default null
 572		 */
 573		this.mask = null;
 574
 575		/**
 576		 * A display object that will be tested when checking mouse interactions or testing {{#crossLink &quot;Container/getObjectsUnderPoint&quot;}}{{/crossLink}}.
 577		 * The hit area will have its transformation applied relative to this display object&#x27;s coordinate space (as though
 578		 * the hit test object were a child of this display object and relative to its regX/Y). The hitArea will be tested
 579		 * using only its own &#x60;alpha&#x60; value regardless of the alpha value on the target display object, or the target&#x27;s
 580		 * ancestors (parents).
 581		 * 
 582		 * If set on a {{#crossLink &quot;Container&quot;}}{{/crossLink}}, children of the Container will not receive mouse events.
 583		 * This is similar to setting {{#crossLink &quot;mouseChildren&quot;}}{{/crossLink}} to false.
 584		 *
 585		 * Note that hitArea is NOT currently used by the &#x60;hitTest()&#x60; method, nor is it supported for {{#crossLink &quot;Stage&quot;}}{{/crossLink}}.
 586		 * @property hitArea
 587		 * @type {DisplayObject}
 588		 * @default null
 589		 */
 590		this.hitArea = null;
 591
 592		/**
 593		 * A CSS cursor (ex. &quot;pointer&quot;, &quot;help&quot;, &quot;text&quot;, etc) that will be displayed when the user hovers over this display
 594		 * object. You must enable mouseover events using the {{#crossLink &quot;Stage/enableMouseOver&quot;}}{{/crossLink}} method to
 595		 * use this property. Setting a non-null cursor on a Container will override the cursor set on its descendants.
 596		 * @property cursor
 597		 * @type {String}
 598		 * @default null
 599		 */
 600		this.cursor = null;
 601
 602
 603	// private properties:
 604		/**
 605		 * Moved to {{#crossLink &quot;BitmapCache&quot;}}{{/crossLink}}
 606		 * @property _cacheScale
 607		 * @protected
 608		 * @type {Number}
 609		 * @default 1
 610		 * @deprecated
 611		 **/
 612
 613		/**
 614		 * Moved to {{#crossLink &quot;BitmapCache&quot;}}{{/crossLink}}
 615		 * @property _cacheDataURLID
 616		 * @protected
 617		 * @type {Number}
 618		 * @default 0
 619		 * @deprecated
 620		 */
 621
 622		/**
 623		 * Moved to {{#crossLink &quot;BitmapCache&quot;}}{{/crossLink}}
 624		 * @property _cacheDataURL
 625		 * @protected
 626		 * @type {String}
 627		 * @default null
 628		 * @deprecated
 629		 */
 630
 631		/**
 632		 * @property _props
 633		 * @protected
 634		 * @type {DisplayObject}
 635		 * @default null
 636		 **/
 637		this._props = new createjs.DisplayProps();
 638
 639		/**
 640		 * @property _rectangle
 641		 * @protected
 642		 * @type {Rectangle}
 643		 * @default null
 644		 **/
 645		this._rectangle = new createjs.Rectangle();
 646
 647		/**
 648		 * @property _bounds
 649		 * @protected
 650		 * @type {Rectangle}
 651		 * @default null
 652		 **/
 653		this._bounds = null;
 654
 655		/**
 656		 * Where StageGL should look for required display properties, matters only for leaf display objects. Containers
 657		 * or cached objects won&#x27;t use this property, it&#x27;s for native display of terminal elements.
 658		 * @property _webGLRenderStyle
 659		 * @protected
 660		 * @type {number}
 661		 * @default 0
 662		 */
 663		this._webGLRenderStyle = DisplayObject._StageGL_NONE;
 664	}
 665	var p = createjs.extend(DisplayObject, createjs.EventDispatcher);
 666
 667// static properties:
 668	/**
 669	 * Listing of mouse event names. Used in _hasMouseEventListener.
 670	 * @property _MOUSE_EVENTS
 671	 * @protected
 672	 * @static
 673	 * @type {Array}
 674	 **/
 675	DisplayObject._MOUSE_EVENTS = [&quot;click&quot;,&quot;dblclick&quot;,&quot;mousedown&quot;,&quot;mouseout&quot;,&quot;mouseover&quot;,&quot;pressmove&quot;,&quot;pressup&quot;,&quot;rollout&quot;,&quot;rollover&quot;];
 676
 677	/**
 678	 * Suppresses errors generated when using features like hitTest, mouse events, and {{#crossLink &quot;getObjectsUnderPoint&quot;}}{{/crossLink}}
 679	 * with cross domain content.
 680	 * @property suppressCrossDomainErrors
 681	 * @static
 682	 * @type {Boolean}
 683	 * @default false
 684	 **/
 685	DisplayObject.suppressCrossDomainErrors = false;
 686
 687	/**
 688	 * @property _snapToPixelEnabled
 689	 * @protected
 690	 * @static
 691	 * @type {Boolean}
 692	 * @default false
 693	 **/
 694	DisplayObject._snapToPixelEnabled = false; // stage.snapToPixelEnabled is temporarily copied here during a draw to provide global access.
 695
 696	/**
 697	 * Enum like property for determining StageGL render lookup, i.e. where to expect properties.
 698	 * @property _StageGL_NONE
 699	 * @protected
 700	 * @static
 701	 * @type {number}
 702	 */
 703	DisplayObject._StageGL_NONE = 0;
 704
 705	/**
 706	 * Enum like property for determining StageGL render lookup, i.e. where to expect properties.
 707	 * @property _StageGL_SPRITE
 708	 * @protected
 709	 * @static
 710	 * @type {number}
 711	 */
 712	DisplayObject._StageGL_SPRITE = 1;
 713
 714	/**
 715	 * Enum like property for determining StageGL render lookup, i.e. where to expect properties.
 716	 * @property _StageGL_BITMAP
 717	 * @protected
 718	 * @static
 719	 * @type {number}
 720	 */
 721	DisplayObject._StageGL_BITMAP = 2;
 722
 723	/**
 724	 * @property _hitTestCanvas
 725	 * @type {HTMLCanvasElement | Object}
 726	 * @static
 727	 * @protected
 728	 **/
 729	/**
 730	 * @property _hitTestContext
 731	 * @type {CanvasRenderingContext2D}
 732	 * @static
 733	 * @protected
 734	 **/
 735	var canvas = createjs.createCanvas?createjs.createCanvas():document.createElement(&quot;canvas&quot;); // prevent errors on load in browsers without canvas.
 736	if (canvas.getContext) {
 737		DisplayObject._hitTestCanvas = canvas;
 738		DisplayObject._hitTestContext = canvas.getContext(&quot;2d&quot;);
 739		canvas.width = canvas.height = 1;
 740	}
 741
 742// events:
 743	/**
 744	 * Dispatched when the user presses their left mouse button over the display object. See the 
 745	 * {{#crossLink &quot;MouseEvent&quot;}}{{/crossLink}} class for a listing of event properties.
 746	 * @event mousedown
 747	 * @since 0.6.0
 748	 */
 749
 750	/**
 751	 * Dispatched when the user presses their left mouse button and then releases it while over the display object.
 752	 * See the {{#crossLink &quot;MouseEvent&quot;}}{{/crossLink}} class for a listing of event properties.
 753	 * @event click
 754	 * @since 0.6.0
 755	 */
 756
 757	/**
 758	 * Dispatched when the user double clicks their left mouse button over this display object.
 759	 * See the {{#crossLink &quot;MouseEvent&quot;}}{{/crossLink}} class for a listing of event properties.
 760	 * @event dblclick
 761	 * @since 0.6.0
 762	 */
 763
 764	/**
 765	 * Dispatched when the user&#x27;s mouse enters this display object. This event must be enabled using 
 766	 * {{#crossLink &quot;Stage/enableMouseOver&quot;}}{{/crossLink}}. See also {{#crossLink &quot;DisplayObject/rollover:event&quot;}}{{/crossLink}}.
 767	 * See the {{#crossLink &quot;MouseEvent&quot;}}{{/crossLink}} class for a listing of event properties.
 768	 * @event mouseover
 769	 * @since 0.6.0
 770	 */
 771
 772	/**
 773	 * Dispatched when the user&#x27;s mouse leaves this display object. This event must be enabled using 
 774	 * {{#crossLink &quot;Stage/enableMouseOver&quot;}}{{/crossLink}}. See also {{#crossLink &quot;DisplayObject/rollout:event&quot;}}{{/crossLink}}.
 775	 * See the {{#crossLink &quot;MouseEvent&quot;}}{{/crossLink}} class for a listing of event properties.
 776	 * @event mouseout
 777	 * @since 0.6.0
 778	 */
 779
 780	/**
 781	 * This event is similar to {{#crossLink &quot;DisplayObject/mouseover:event&quot;}}{{/crossLink}}, with the following
 782	 * differences: it does not bubble, and it considers {{#crossLink &quot;Container&quot;}}{{/crossLink}} instances as an
 783	 * aggregate of their content.
 784	 * 
 785	 * For example, myContainer contains two overlapping children: shapeA and shapeB. The user moves their mouse over
 786	 * shapeA and then directly on to shapeB. With a listener for {{#crossLink &quot;mouseover:event&quot;}}{{/crossLink}} on
 787	 * myContainer, two events would be received, each targeting a child element:&lt;OL&gt;
 788	 * &lt;LI&gt;when the mouse enters shapeA (target=shapeA)&lt;/LI&gt;
 789	 * &lt;LI&gt;when the mouse enters shapeB (target=shapeB)&lt;/LI&gt;
 790	 * &lt;/OL&gt;
 791	 * However, with a listener for &quot;rollover&quot; instead, only a single event is received when the mouse first enters
 792	 * the aggregate myContainer content (target=myContainer).
 793	 * 
 794	 * This event must be enabled using {{#crossLink &quot;Stage/enableMouseOver&quot;}}{{/crossLink}}.
 795	 * See the {{#crossLink &quot;MouseEvent&quot;}}{{/crossLink}} class for a listing of event properties.
 796	 * @event rollover
 797	 * @since 0.7.0
 798	 */
 799
 800	/**
 801	 * This event is similar to {{#crossLink &quot;DisplayObject/mouseout:event&quot;}}{{/crossLink}}, with the following
 802	 * differences: it does not bubble, and it considers {{#crossLink &quot;Container&quot;}}{{/crossLink}} instances as an
 803	 * aggregate of their content.
 804	 * 
 805	 * For example, myContainer contains two overlapping children: shapeA and shapeB. The user moves their mouse over
 806	 * shapeA, then directly on to shapeB, then off both. With a listener for {{#crossLink &quot;mouseout:event&quot;}}{{/crossLink}}
 807	 * on myContainer, two events would be received, each targeting a child element:&lt;OL&gt;
 808	 * &lt;LI&gt;when the mouse leaves shapeA (target=shapeA)&lt;/LI&gt;
 809	 * &lt;LI&gt;when the mouse leaves shapeB (target=shapeB)&lt;/LI&gt;
 810	 * &lt;/OL&gt;
 811	 * However, with a listener for &quot;rollout&quot; instead, only a single event is received when the mouse leaves
 812	 * the aggregate myContainer content (target=myContainer).
 813	 * 
 814	 * This event must be enabled using {{#crossLink &quot;Stage/enableMouseOver&quot;}}{{/crossLink}}.
 815	 * See the {{#crossLink &quot;MouseEvent&quot;}}{{/crossLink}} class for a listing of event properties.
 816	 * @event rollout
 817	 * @since 0.7.0
 818	 */
 819
 820	/**
 821	 * After a {{#crossLink &quot;DisplayObject/mousedown:event&quot;}}{{/crossLink}} occurs on a display object, a pressmove
 822	 * event will be generated on that object whenever the mouse moves until the mouse press is released. This can be
 823	 * useful for dragging and similar operations.
 824	 *
 825	 * **Please note** that if the initial mouse target from a &#x60;mousedown&#x60; event is removed from the stage after being pressed
 826	 * (e.g. during a &#x60;pressmove&#x60; event), a &#x60;pressmove&#x60; event is still generated. However since it is no longer in the
 827	 * display list, the event can not bubble. This means that previous ancestors (parent containers) will not receive
 828	 * the event, and therefore can not re-dispatch it. If you intend to listen for &#x60;{{#crossLink &quot;DisplayObject/pressup:event&quot;}}{{/crossLink}}&#x60;
 829	 * or &#x60;pressmove&#x60; on a dynamic object (such as a {{#crossLink &quot;MovieClip&quot;}}{{/crossLink}} or {{#crossLink &quot;Container&quot;}}{{/crossLink}}),
 830	 * then ensure you set {{#crossLink &quot;Container/mouseChildren:property&quot;}}{{/crossLink}} to &#x60;false&#x60;.
 831	 * @event pressmove
 832	 * @since 0.7.0
 833	 */
 834
 835	/**
 836	 * After a {{#crossLink &quot;DisplayObject/mousedown:event&quot;}}{{/crossLink}} occurs on a display object, a pressup event
 837	 * will be generated on that object when that mouse press is released. This can be useful for dragging and similar
 838	 * operations.
 839	 *
 840	 * **Please note** that if the initial mouse target from a &#x60;mousedown&#x60; event is removed from the stage after being pressed
 841	 * (e.g. during a &#x60;pressmove&#x60; event), a &#x60;pressup&#x60; event is still generated. However since it is no longer in the
 842	 * display list, the event can not bubble. This means that previous ancestors (parent containers) will not receive
 843	 * the event, and therefore can not re-dispatch it. If you intend to listen for &#x60;{{#crossLink &quot;DisplayObject/pressmove:event&quot;}}{{/crossLink}}&#x60;
 844	 * or &#x60;pressup&#x60; on a dynamic object (such as a {{#crossLink &quot;MovieClip&quot;}}{{/crossLink}} or {{#crossLink &quot;Container&quot;}}{{/crossLink}}),
 845	 * then ensure you set {{#crossLink &quot;Container/mouseChildren:property&quot;}}{{/crossLink}} to &#x60;false&#x60;.
 846	 * @event pressup
 847	 * @since 0.7.0
 848	 */
 849
 850	/**
 851	 * Dispatched when the display object is added to a parent container.
 852	 * @event added
 853	 */
 854
 855	/**
 856	 * Dispatched when the display object is removed from its parent container.
 857	 * @event removed
 858	 */
 859
 860	/**
 861	 * Dispatched on each display object on a stage whenever the stage updates. This occurs immediately before the
 862	 * rendering (draw) pass. When {{#crossLink &quot;Stage/update&quot;}}{{/crossLink}} is called, first all display objects on
 863	 * the stage dispatch the tick event, then all of the display objects are drawn to stage. Children will have their
 864	 * {{#crossLink &quot;tick:event&quot;}}{{/crossLink}} event dispatched in order of their depth prior to the event being
 865	 * dispatched on their parent.
 866	 * @event tick
 867	 * @param {Object} target The object that dispatched the event.
 868	 * @param {String} type The event type.
 869	 * @param {Array} params An array containing any arguments that were passed to the Stage.update() method. For
 870	 *      example if you called stage.update(&quot;hello&quot;), then the params would be [&quot;hello&quot;].
 871	 * @since 0.6.0
 872	 */
 873
 874
 875// getter / setters:
 876	/**
 877	 * Use the {{#crossLink &quot;DisplayObject/stage:property&quot;}}{{/crossLink}} property instead.
 878	 * @method _getStage
 879	 * @protected
 880	 * @return {Stage}
 881	 **/
 882	p._getStage = function() {
 883		// uses dynamic access to avoid circular dependencies;
 884		var o = this, _Stage = createjs[&quot;Stage&quot;];
 885		while (o.parent) { o = o.parent; }
 886		if (o instanceof _Stage) { return o; }
 887		return null;
 888	};
 889	// DisplayObject.getStage is @deprecated. Remove for 1.1+
 890	p.getStage = createjs.deprecate(p._getStage, &quot;DisplayObject.getStage&quot;);
 891
 892	/**
 893	 * Returns the Stage instance that this display object will be rendered on, or null if it has not been added to one.
 894	 * @property stage
 895	 * @type {Stage}
 896	 * @readonly
 897	 **/
 898
 899	/**
 900	 * Returns an ID number that uniquely identifies the current cache for this display object. This can be used to
 901	 * determine if the cache has changed since a previous check.
 902	 * Moved to {{#crossLink &quot;BitmapCache&quot;}}{{/crossLink}}
 903	 * @property cacheID
 904	 * @deprecated
 905	 * @type {Number}
 906	 * @default 0
 907	 */
 908
 909	/**
 910	 * Set both the {{#crossLink &quot;DisplayObject/scaleX:property&quot;}}{{/crossLink}} and the {{#crossLink &quot;DisplayObject/scaleY&quot;}}{{/crossLink}}
 911	 * property to the same value. Note that when you get the value, if the &#x60;scaleX&#x60; and &#x60;scaleY&#x60; are different values,
 912	 * it will return only the &#x60;scaleX&#x60;.
 913	 * @property scaleX
 914	 * @type {Number}
 915	 * @default 1
 916	 */
 917	try {
 918		Object.defineProperties(p, {
 919			stage: { get: p._getStage },
 920			cacheID: {
 921				get: function(){ return this.bitmapCache &amp;&amp; this.bitmapCache.cacheID },
 922				set: function(a){ this.bitmapCache &amp;&amp; (this.bitmapCache.cacheID = a) }
 923			},
 924			scale: {
 925				get: function() { return this.scaleX; },
 926				set: function(scale) { this.scaleX = this.scaleY = scale; },
 927			}
 928		});
 929	} catch (e) {}
 930
 931
 932// public methods:
 933	/**
 934	 * Returns true or false indicating whether the display object would be visible if drawn to a canvas.
 935	 * This does not account for whether it would be visible within the boundaries of the stage.
 936	 *
 937	 * NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
 938	 * @method isVisible
 939	 * @return {Boolean} Boolean indicating whether the display object would be visible if drawn to a canvas
 940	 **/
 941	p.isVisible = function() {
 942		return !!(this.visible &amp;&amp; this.alpha &gt; 0 &amp;&amp; this.scaleX != 0 &amp;&amp; this.scaleY != 0);
 943	};
 944
 945	/**
 946	 * Draws the display object into the specified context ignoring its visible, alpha, shadow, and transform.
 947	 * Returns &lt;code&gt;true&lt;/code&gt; if the draw was handled (useful for overriding functionality).
 948	 *
 949	 * NOTE: This method is mainly for internal use, though it may be useful for advanced uses.
 950	 * @method draw
 951	 * @param {CanvasRenderingContext2D} ctx The canvas 2D context object to draw into.
 952	 * @param {Boolean} [ignoreCache=false] Indicates whether the draw operation should ignore any current cache. For example,
 953	 * used for drawing the cache (to prevent it from simply drawing an existing cache back into itself).
 954	 * @return {Boolean}
 955	 **/
 956	p.draw = function(ctx, ignoreCache) {
 957		var cache = this.bitmapCache;
 958		if(cache &amp;&amp; !ignoreCache) {
 959			return cache.draw(ctx);
 960		}
 961		return false;
 962	};
 963
 964	/**
 965	 * Applies this display object&#x27;s transformation, alpha, globalCompositeOperation, clipping path (mask), and shadow
 966	 * to the specified context. This is typically called prior to {{#crossLink &quot;DisplayObject/draw&quot;}}{{/crossLink}}.
 967	 * @method updateContext
 968	 * @param {CanvasRenderingContext2D} ctx The canvas 2D to update.
 969	 **/
 970	p.updateContext = function(ctx) {
 971		var o=this, mask=o.mask, mtx= o._props.matrix;
 972		
 973		if (mask &amp;&amp; mask.graphics &amp;&amp; !mask.graphics.isEmpty()) {
 974			mask.getMatrix(mtx);
 975			ctx.transform(mtx.a,  mtx.b, mtx.c, mtx.d, mtx.tx, mtx.ty);
 976			
 977			mask.graphics.drawAsPath(ctx);
 978			ctx.clip();
 979			
 980			mtx.invert();
 981			ctx.transform(mtx.a,  mtx.b, mtx.c, mtx.d, mtx.tx, mtx.ty);
 982		}
 983		
 984		this.getMatrix(mtx);
 985		var tx = mtx.tx, ty = mtx.ty;
 986		if (DisplayObject._snapToPixelEnabled &amp;&amp; o.snapToPixel) {
 987			tx = tx + (tx &lt; 0 ? -0.5 : 0.5) | 0;
 988			ty = ty + (ty &lt; 0 ? -0.5 : 0.5) | 0;
 989		}
 990		ctx.transform(mtx.a,  mtx.b, mtx.c, mtx.d, tx, ty);
 991		ctx.globalAlpha *= o.alpha;
 992		if (o.compositeOperation) { ctx.globalCompositeOperation = o.compositeOperation; }
 993		if (o.shadow) { this._applyShadow(ctx, o.shadow); }
 994	};
 995
 996	/**
 997	 * Draws the display object into a new element, which is then used for subsequent draws. Intended for complex content
 998	 * that does not change frequently (ex. a Container with many children that do not move, or a complex vector Shape),
 999	 * this can provide for much faster rendering because the content does not need to be re-rendered each tick. The
1000	 * cached display object can be moved, rotated, faded, etc freely, however if its content changes, you must manually
1001	 * update the cache by calling &lt;code&gt;updateCache()&lt;/code&gt; again. You must specify the cached area via the x, y, w,
1002	 * and h parameters. This defines the rectangle that will be rendered and cached using this display object&#x27;s coordinates.
1003	 *
1004	 * &lt;h4&gt;Example&lt;/h4&gt;
1005	 * For example if you defined a Shape that drew a circle at 0, 0 with a radius of 25:
1006	 *
1007	 *      var shape = new createjs.Shape();
1008	 *      shape.graphics.beginFill(&quot;#ff0000&quot;).drawCircle(0, 0, 25);
1009	 *      shape.cache(-25, -25, 50, 50);
1010	 *
1011	 * Note that filters need to be defined &lt;em&gt;before&lt;/em&gt; the cache is applied or you will have to call updateCache after
1012	 * application. Check out the {{#crossLink &quot;Filter&quot;}}{{/crossLink}} class for more information. Some filters
1013	 * (ex. BlurFilter) may not work as expected in conjunction with the scale param.
1014	 * 
1015	 * Usually, the resulting cacheCanvas will have the dimensions width * scale, height * scale, however some filters (ex. BlurFilter)
1016	 * will add padding to the canvas dimensions.
1017	 *
1018	 * In previous versions caching was handled on DisplayObject but has since been moved to {{#crossLink &quot;BitmapCache&quot;}}{{/crossLink}}.
1019	 * This allows for easier interaction and alternate cache methods like WebGL with {{#crossLink &quot;StageGL&quot;}}{{/crossLink}}.
1020	 * For more information on the options object, see the BitmapCache {{#crossLink &quot;BitmapCache/define&quot;}}{{/crossLink}}.
1021	 *
1022	 * @method cache
1023	 * @param {Number} x The x coordinate origin for the cache region.
1024	 * @param {Number} y The y coordinate origin for the cache region.
1025	 * @param {Number} width The width of the cache region.
1026	 * @param {Number} height The height of the cache region.
1027	 * @param {Number} [scale=1] The scale at which the cache will be created. For example, if you cache a vector shape using
1028	 * 	myShape.cache(0,0,100,100,2) then the resulting cacheCanvas will be 200x200 px. This lets you scale and rotate
1029	 * 	cached elements with greater fidelity. Default is 1.
1030	 * @param {Object} [options=undefined] Specify additional parameters for the cache logic
1031	 **/
1032	p.cache = function(x, y, width, height, scale, options) {
1033		if(!this.bitmapCache){
1034			this.bitmapCache = new createjs.BitmapCache();
1035		}
1036		this.bitmapCache.define(this, x, y, width, height, scale, options);
1037	};
1038
1039	/**
1040	 * Redraws the display object to its cache. Calling updateCache without an active cache will throw an error.
1041	 * If compositeOperation is null the current cache will be cleared prior to drawing. Otherwise the display object
1042	 * will be drawn over the existing cache using the specified compositeOperation.
1043	 *
1044	 * &lt;h4&gt;Example&lt;/h4&gt;
1045	 * Clear the current graphics of a cached shape, draw some new instructions, and then update the cache. The new line
1046	 * will be drawn on top of the old one.
1047	 *
1048	 *      // Not shown: Creating the shape, and caching it.
1049	 *      shapeInstance.clear();
1050	 *      shapeInstance.setStrokeStyle(3).beginStroke(&quot;#ff0000&quot;).moveTo(100, 100).lineTo(200,200);
1051	 *      shapeInstance.updateCache();
1052	 *
1053	 * In previous versions caching was handled on DisplayObject but has since been moved to {{#crossLink &quot;BitmapCache&quot;}}{{/crossLink}}.
1054	 * This allows for easier interaction and alternate cache methods like WebGL and {{#crossLink &quot;StageGL&quot;}}{{/crossLink}}.
1055	 *
1056	 * @method updateCache
1057	 * @param {String} compositeOperation The compositeOperation to use, or null to clear the cache and redraw it.
1058	 * &lt;a href=&quot;https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-globalcompositeoperation&quot;&gt;
1059	 * whatwg spec on compositing&lt;/a&gt;.
1060	 **/
1061	p.updateCache = function(compositeOperation) {
1062		if(!this.bitmapCache) {
1063			throw &quot;cache() must be called before updateCache()&quot;;
1064		}
1065		this.bitmapCache.update(compositeOperation);
1066	};
1067
1068	/**
1069	 * Clears the current cache. See {{#crossLink &quot;DisplayObject/cache&quot;}}{{/crossLink}} for more information.
1070	 * @method uncache
1071	 **/
1072	p.uncache = function() {
1073		if(this.bitmapCache) {
1074			this.bitmapCache.release();
1075			this.bitmapCache = undefined;
1076		}
1077	};
1078
1079	/**
1080	 * Returns a data URL for the cache, or null if this display object is not cached.
1081	 * Only generated if the cache has changed, otherwise returns last result.
1082	 * @method getCacheDataURL
1083	 * @return {String} The image data url for the cache.
1084	 **/
1085	p.getCacheDataURL = function() {
1086		return this.bitmapCache?this.bitmapCache.getDataURL():null;
1087	};
1088
1089	/**
1090	 * Transforms the specified x and y position from the coordinate space of the display object
1091	 * to the global (stage) coordinate space. For example, this could be used to position an HTML label
1092	 * over a specific point on a nested display object. Returns a Point instance with x and y properties
1093	 * correlating to the transformed coordinates on the stage.
1094	 *
1095	 * &lt;h4&gt;Example&lt;/h4&gt;
1096	 *
1097	 *      displayObject.x = 300;
1098	 *      displayObject.y = 200;
1099	 *      stage.addChild(displayObject);
1100	 *      var point = displayObject.localToGlobal(100, 100);
1101	 *      // Results in x=400, y=300
1102	 *
1103	 * @method localToGlobal
1104	 * @param {Number} x The x position in the source display object to transform.
1105	 * @param {Number} y The y position in the source display object to transform.
1106	 * @param {Point | Object} [pt] An object to copy the result into. If omitted a new Point object with x/y properties will be returned. 
1107	 * @return {Point} A Point instance with x and y properties correlating to the transformed coordinates
1108	 * on the stage.
1109	 **/
1110	p.localToGlobal = function(x, y, pt) {
1111		return this.getConcatenatedMatrix(this._props.matrix).transformPoint(x,y, pt||new createjs.Point());
1112	};
1113
1114	/**
1115	 * Transforms the specified x and y position from the global (stage) coordinate space to the
1116	 * coordinate space of the display object. For example, this could be used to determine
1117	 * the current mouse position within the display object. Returns a Point instance with x and y properties
1118	 * correlating to the transformed position in the display object&#x27;s coordinate space.
1119	 *
1120	 * &lt;h4&gt;Example&lt;/h4&gt;
1121	 *
1122	 *      displayObject.x = 300;
1123	 *      displayObject.y = 200;
1124	 *      stage.addChild(displayObject);
1125	 *      var point = displayObject.globalToLocal(100, 100);
1126	 *      // Results in x=-200, y=-100
1127	 *
1128	 * @method globalToLocal
1129	 * @param {Number} x The x position on the stage to transform.
1130	 * @param {Number} y The y position on the stage to transform.
1131	 * @param {Point | Object} [pt] An object to copy the result into. If omitted a new Point object with x/y properties will be returned. 
1132	 * @return {Point} A Point instance with x and y properties correlating to the transformed position in the
1133	 * display object&#x27;s coordinate space.
1134	 **/
1135	p.globalToLocal = function(x, y, pt) {
1136		return this.getConcatenatedMatrix(this._props.matrix).invert().transformPoint(x,y, pt||new createjs.Point());
1137	};
1138
1139	/**
1140	 * Transforms the specified x and y position from the coordinate space of this display object to the coordinate
1141	 * space of the target display object. Returns a Point instance with x and y properties correlating to the
1142	 * transformed position in the target&#x27;s coordinate space. Effectively the same as using the following code with
1143	 * {{#crossLink &quot;DisplayObject/localToGlobal&quot;}}{{/crossLink}} and {{#crossLink &quot;DisplayObject/globalToLocal&quot;}}{{/crossLink}}.
1144	 *
1145	 *      var pt = this.localToGlobal(x, y);
1146	 *      pt = target.globalToLocal(pt.x, pt.y);
1147	 *
1148	 * @method localToLocal
1149	 * @param {Number} x The x position in the source display object to transform.
1150	 * @param {Number} y The y position on the source display object to transform.
1151	 * @param {DisplayObject} target The target display object to which the coordinates will be transformed.
1152	 * @param {Point | Object} [pt] An object to copy the result into. If omitted a new Point object with x/y properties will be returned. 
1153	 * @return {Point} Returns a Point instance with x and y properties correlating to the transformed position
1154	 * in the target&#x27;s coordinate space.
1155	 **/
1156	p.localToLocal = function(x, y, target, pt) {
1157		pt = this.localToGlobal(x, y, pt);
1158		return target.globalToLocal(pt.x, pt.y, pt);
1159	};
1160
1161	/**
1162	 * Shortcut method to quickly set the transform properties on the display object. All parameters are optional.
1163	 * Omitted parameters will have the default value set.
1164	 *
1165	 * &lt;h4&gt;Example&lt;/h4&gt;
1166	 *
1167	 *      displayObject.setTransform(100, 100, 2, 2);
1168	 *
1169	 * @method setTransform
1170	 * @param {Number} [x=0] The horizontal translation (x position) in pixels
1171	 * @param {Number} [y=0] The vertical translation (y position) in pixels
1172	 * @param {Number} [scaleX=1] The horizontal scale, as a percentage of 1
1173	 * @param {Number} [scaleY=1] the vertical scale, as a percentage of 1
1174	 * @param {Number} [rotation=0] The rotation, in degrees
1175	 * @param {Number} [skewX=0] The horizontal skew factor
1176	 * @param {Number} [skewY=0] The vertical skew factor
1177	 * @param {Number} [regX=0] The horizontal registration point in pixels
1178	 * @param {Number} [regY=0] The vertical registration point in pixels
1179	 * @return {DisplayObject} Returns this instance. Useful for chaining commands.
1180	 * @chainable
1181	*/
1182	p.setTransform = function(x, y, scaleX, scaleY, rotation, skewX, skewY, regX, regY) {
1183		this.x = x || 0;
1184		this.y = y || 0;
1185		this.scaleX = scaleX == null ? 1 : scaleX;
1186		this.scaleY = scaleY == null ? 1 : scaleY;
1187		this.rotation = rotation || 0;
1188		this.skewX = skewX || 0;
1189		this.skewY = skewY || 0;
1190		this.regX = regX || 0;
1191		this.regY = regY || 0;
1192		return this;
1193	};
1194
1195	/**
1196	 * Returns a matrix based on this object&#x27;s current transform.
1197	 * @method getMatrix
1198	 * @param {Matrix2D} matrix Optional. A Matrix2D object to populate with the calculated values. If null, a new
1199	 * Matrix object is returned.
1200	 * @return {Matrix2D} A matrix representing this display object&#x27;s transform.
1201	 **/
1202	p.getMatrix = function(matrix) {
1203		var o = this, mtx = matrix&amp;&amp;matrix.identity() || new createjs.Matrix2D();
1204		return o.transformMatrix ?  mtx.copy(o.transformMatrix) : mtx.appendTransform(o.x, o.y, o.scaleX, o.scaleY, o.rotation, o.skewX, o.skewY, o.regX, o.regY);
1205	};
1206
1207	/**
1208	 * Generates a Matrix2D object representing the combined transform of the display object and all of its
1209	 * parent Containers up to the highest level ancestor (usually the {{#crossLink &quot;Stage&quot;}}{{/crossLink}}). This can
1210	 * be used to transform positions between coordinate spaces, such as with {{#crossLink &quot;DisplayObject/localToGlobal&quot;}}{{/crossLink}}
1211	 * and {{#crossLink &quot;DisplayObject/globalToLocal&quot;}}{{/crossLink}}.
1212	 * @method getConcatenatedMatrix
1213	 * @param {Matrix2D} [matrix] A {{#crossLink &quot;Matrix2D&quot;}}{{/crossLink}} object to populate with the calculated values.
1214	 * If null, a new Matrix2D object is returned.
1215	 * @return {Matrix2D} The combined matrix.
1216	 **/
1217	p.getConcatenatedMatrix = function(matrix) {
1218		var o = this, mtx = this.getMatrix(matrix);
1219		while (o = o.parent) {
1220			mtx.prependMatrix(o.getMatrix(o._props.matrix));
1221		}
1222		return mtx;
1223	};
1224
1225	/**
1226	 * Generates a DisplayProps object representing the combined display properties of the  object and all of its
1227	 * parent Containers up to the highest level ancestor (usually the {{#crossLink &quot;Stage&quot;}}{{/crossLink}}).
1228	 * @method getConcatenatedDisplayProps
1229	 * @param {DisplayProps} [props] A {{#crossLink &quot;DisplayProps&quot;}}{{/crossLink}} object to populate with the calculated values.
1230	 * If null, a new DisplayProps object is returned.
1231	 * @return {DisplayProps} The combined display properties.
1232	 **/
1233	p.getConcatenatedDisplayProps = function(props) {
1234		props = props ? props.identity() : new createjs.DisplayProps();
1235		var o = this, mtx = o.getMatrix(props.matrix); 
1236		do {
1237			props.prepend(o.visible, o.alpha, o.shadow, o.compositeOperation);
1238			
1239			// we do this to avoid problems with the matrix being used for both operations when o._props.matrix is passed in as the props param.
1240			// this could be simplified (ie. just done as part of the prepend above) if we switched to using a pool.
1241			if (o != this) { mtx.prependMatrix(o.getMatrix(o._props.matrix)); }
1242		} while (o = o.parent);
1243		return props;
1244	};
1245
1246	/**
1247	 * Tests whether the display object intersects the specified point in local coordinates (ie. draws a pixel with alpha &gt; 0 at
1248	 * the specified position). This ignores the alpha, shadow, hitArea, mask, and compositeOperation of the display object.
1249	 *
1250	 * &lt;h4&gt;Example&lt;/h4&gt;
1251	 *
1252	 *      stage.addEventListener(&quot;stagemousedown&quot;, handleMouseDown);
1253	 *      function handleMouseDown(event) {
1254	 *          var hit = myShape.hitTest(event.stageX, event.stageY);
1255	 *      }
1256	 *
1257	 * Please note that shape-to-shape collision is not currently supported by EaselJS.
1258	 * @method hitTest
1259	 * @param {Number} x The x position to check in the display object&#x27;s local coordinates.
1260	 * @param {Number} y The y position to check in the display object&#x27;s local coordinates.
1261	 * @return {Boolean} A Boolean indicating whether a visible portion of the DisplayObject intersect the specified
1262	 * local Point.
1263	*/
1264	p.hitTest = function(x, y) {
1265		var ctx = DisplayObject._hitTestContext;
1266		ctx.setTransform(1, 0, 0, 1, -x, -y);
1267		this.draw(ctx);
1268
1269		var hit = this._testHit(ctx);
1270		ctx.setTransform(1, 0, 0, 1, 0, 0);
1271		ctx.clearRect(0, 0, 2, 2);
1272		return hit;
1273	};
1274
1275	/**
1276	 * Provides a chainable shortcut method for setting a number of properties on the instance.
1277	 *
1278	 * &lt;h4&gt;Example&lt;/h4&gt;
1279	 *
1280	 *      var myGraphics = new createjs.Graphics().beginFill(&quot;#ff0000&quot;).drawCircle(0, 0, 25);
1281	 *      var shape = stage.addChild(new Shape()).set({graphics:myGraphics, x:100, y:100, alpha:0.5});
1282	 *
1283	 * @method set
1284	 * @param {Object} props A generic object containing properties to copy to the DisplayObject instance.
1285	 * @return {DisplayObject} Returns the instance the method is called on (useful for chaining calls.)
1286	 * @chainable
1287	*/
1288	p.set = function(props) {
1289		for (var n in props) { this[n] = props[n]; }
1290		return this;
1291	};
1292
1293	/**
1294	 * Returns a rectangle representing this object&#x27;s bounds in its local coordinate system (ie. with no transformation).
1295	 * Objects that have been cached will return the bounds of the cache.
1296	 * 
1297	 * Not all display objects can calculate their own bounds (ex. Shape). For these objects, you can use 
1298	 * {{#crossLink &quot;DisplayObject/setBounds&quot;}}{{/crossLink}} so that they are included when calculating Container
1299	 * bounds.
1300	 * 
1301	 * &lt;table&gt;
1302	 * 	&lt;tr&gt;&lt;td&gt;&lt;b&gt;All&lt;/b&gt;&lt;/td&gt;&lt;td&gt;
1303	 * 		All display objects support setting bounds manually using setBounds(). Likewise, display objects that
1304	 * 		have been cached using cache() will return the bounds of their cache. Manual and cache bounds will override
1305	 * 		the automatic calculations listed below.
1306	 * 	&lt;/td&gt;&lt;/tr&gt;
1307	 * 	&lt;tr&gt;&lt;td&gt;&lt;b&gt;Bitmap&lt;/b&gt;&lt;/td&gt;&lt;td&gt;
1308	 * 		Returns the width and height of the sourceRect (if specified) or image, extending from (x=0,y=0).
1309	 * 	&lt;/td&gt;&lt;/tr&gt;
1310	 * 	&lt;tr&gt;&lt;td&gt;&lt;b&gt;Sprite&lt;/b&gt;&lt;/td&gt;&lt;td&gt;
1311	 * 		Returns the bounds of the current frame. May have non-zero x/y if a frame registration point was specified
1312	 * 		in the spritesheet data. See also {{#crossLink &quot;SpriteSheet/getFrameBounds&quot;}}{{/crossLink}}
1313	 * 	&lt;/td&gt;&lt;/tr&gt;
1314	 * 	&lt;tr&gt;&lt;td&gt;&lt;b&gt;Container&lt;/b&gt;&lt;/td&gt;&lt;td&gt;
1315	 * 		Returns the aggregate (combined) bounds of all children that return a non-null value from getBounds().
1316	 * 	&lt;/td&gt;&lt;/tr&gt;
1317	 * 	&lt;tr&gt;&lt;td&gt;&lt;b&gt;Shape&lt;/b&gt;&lt;/td&gt;&lt;td&gt;
1318	 * 		Does not currently support automatic bounds calculations. Use setBounds() to manually define bounds.
1319	 * 	&lt;/td&gt;&lt;/tr&gt;
1320	 * 	&lt;tr&gt;&lt;td&gt;&lt;b&gt;Text&lt;/b&gt;&lt;/td&gt;&lt;td&gt;
1321	 * 		Returns approximate bounds. Horizontal values (x/width) are quite accurate, but vertical values (y/height) are
1322	 * 		not, especially when using textBaseline values other than &quot;top&quot;.
1323	 * 	&lt;/td&gt;&lt;/tr&gt;
1324	 * 	&lt;tr&gt;&lt;td&gt;&lt;b&gt;BitmapText&lt;/b&gt;&lt;/td&gt;&lt;td&gt;
1325	 * 		Returns approximate bounds. Values will be more accurate if spritesheet frame registration points are close
1326	 * 		to (x=0,y=0).
1327	 * 	&lt;/td&gt;&lt;/tr&gt;
1328	* &lt;/table&gt;
1329	 * 
1330	 * Bounds can be expensive to calculate for some objects (ex. text, or containers with many children), and
1331	 * are recalculated each time you call getBounds(). You can prevent recalculation on static objects by setting the
1332	 * bounds explicitly:
1333	 * 
1334	 * 	var bounds = obj.getBounds();
1335	 * 	obj.setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
1336	 * 	// getBounds will now use the set values, instead of recalculating
1337	 * 
1338	 * To reduce memory impact, the returned Rectangle instance may be reused internally; clone the instance or copy its
1339	 * values if you need to retain it.
1340	 * 
1341	 * 	var myBounds = obj.getBounds().clone();
1342	 * 	// OR:
1343	 * 	myRect.copy(obj.getBounds());
1344	 * 
1345	 * @method getBounds
1346	 * @return {Rectangle} A Rectangle instance representing the bounds, or null if bounds are not available for this
1347	 * object.
1348	 **/
1349	p.getBounds = function() {
1350		if (this._bounds) { return this._rectangle.copy(this._bounds); }
1351		var cacheCanvas = this.cacheCanvas;
1352		if (cacheCanvas) {
1353			var scale = this._cacheScale;
1354			return this._rectangle.setValues(this._cacheOffsetX, this._cacheOffsetY, cacheCanvas.width/scale, cacheCanvas.height/scale);
1355		}
1356		return null;
1357	};
1358
1359	/**
1360	 * Returns a rectangle representing this object&#x27;s bounds in its parent&#x27;s coordinate system (ie. with transformations applied).
1361	 * Objects that have been cached will return the transformed bounds of the cache.
1362	 * 
1363	 * Not all display objects can calculate their own bounds (ex. Shape). For these objects, you can use 
1364	 * {{#crossLink &quot;DisplayObject/setBounds&quot;}}{{/crossLink}} so that they are included when calculating Container
1365	 * bounds.
1366	 * 
1367	 * To reduce memory impact, the returned Rectangle instance may be reused internally; clone the instance or copy its
1368	 * values if you need to retain it.
1369	 * 
1370	 * Container instances calculate aggregate bounds for all children that return bounds via getBounds.
1371	 * @method getTransformedBounds
1372	 * @return {Rectangle} A Rectangle instance representing the bounds, or null if bounds are not available for this object.
1373	 **/
1374	p.getTransformedBounds = function() {
1375		return this._getBounds();
1376	};
1377
1378	/**
1379	 * Allows you to manually specify the bounds of an object that either cannot calculate their own bounds (ex. Shape &amp;
1380	 * Text) for future reference, or so the object can be included in Container bounds. Manually set bounds will always
1381	 * override calculated bounds.
1382	 * 
1383	 * The bounds should be specified in the object&#x27;s local (untransformed) coordinates. For example, a Shape instance
1384	 * with a 25px radius circle centered at 0,0 would have bounds of (-25, -25, 50, 50).
1385	 * @method setBounds
1386	 * @param {Number} x The x origin of the bounds. Pass null to remove the manual bounds.
1387	 * @param {Number} y The y origin of the bounds.
1388	 * @param {Number} width The width of the bounds.
1389	 * @param {Number} height The height of the bounds.
1390	 **/
1391	p.setBounds = function(x, y, width, height) {
1392		if (x == null) { this._bounds = x; return; }
1393		this._bounds = (this._bounds || new createjs.Rectangle()).setValues(x, y, width, height);
1394	};
1395
1396	/**
1397	 * Returns a clone of this DisplayObject. Some properties that are specific to this instance&#x27;s current context are
1398	 * reverted to their defaults (for example .parent). Caches are not maintained across clones, and some elements
1399	 * are copied by reference (masks, individual filter instances, hit area)
1400	 * @method clone
1401	 * @return {DisplayObject} A clone of the current DisplayObject instance.
1402	 **/
1403	p.clone = function() {
1404		return this._cloneProps(new DisplayObject());
1405	};
1406
1407	/**
1408	 * Returns a string representation of this object.
1409	 * @method toString
1410	 * @return {String} a string representation of the instance.
1411	 **/
1412	p.toString = function() {
1413		return &quot;[DisplayObject (name=&quot;+  this.name +&quot;)]&quot;;
1414	};
1415
1416
1417// private methods:
1418	/**
1419	 * Called before the object gets drawn and is a chance to ensure the display state of the object is correct.
1420	 * Mostly used by {{#crossLink &quot;MovieClip&quot;}}{{/crossLink}} and {{#crossLink &quot;BitmapText&quot;}}{{/crossLink}} to
1421	 * correct their internal state and children prior to being drawn.
1422	 *
1423	 * Is manually called via draw in a {{#crossLink &quot;Stage&quot;}}{{/crossLink}} but is automatically called when
1424	 * present in a {{#crossLink &quot;StageGL&quot;}}{{/crossLink}} instance.
1425	 *
1426	 * @method _updateState
1427	 * @default null
1428	 */
1429	p._updateState = null;
1430
1431	// separated so it can be used more easily in subclasses:
1432	/**
1433	 * @method _cloneProps
1434	 * @param {DisplayObject} o The DisplayObject instance which will have properties from the current DisplayObject
1435	 * instance copied into.
1436	 * @return {DisplayObject} o
1437	 * @protected
1438	 **/
1439	p._cloneProps = function(o) {
1440		o.alpha = this.alpha;
1441		o.mouseEnabled = this.mouseEnabled;
1442		o.tickEnabled = this.tickEnabled;
1443		o.name = this.name;
1444		o.regX = this.regX;
1445		o.regY = this.regY;
1446		o.rotation = this.rotation;
1447		o.scaleX = this.scaleX;
1448		o.scaleY = this.scaleY;
1449		o.shadow = this.shadow;
1450		o.skewX = this.skewX;
1451		o.skewY = this.skewY;
1452		o.visible = this.visible;
1453		o.x  = this.x;
1454		o.y = this.y;
1455		o.compositeOperation = this.compositeOperation;
1456		o.snapToPixel = this.snapToPixel;
1457		o.filters = this.filters==null?null:this.filters.slice(0);
1458		o.mask = this.mask;
1459		o.hitArea = this.hitArea;
1460		o.cursor = this.cursor;
1461		o._bounds = this._bounds;
1462		return o;
1463	};
1464
1465	/**
1466	 * @method _applyShadow
1467	 * @protected
1468	 * @param {CanvasRenderingContext2D} ctx
1469	 * @param {Shadow} shadow
1470	 **/
1471	p._applyShadow = function(ctx, shadow) {
1472		shadow = shadow || Shadow.identity;
1473		ctx.shadowColor = shadow.color;
1474		ctx.shadowOffsetX = shadow.offsetX;
1475		ctx.shadowOffsetY = shadow.offsetY;
1476		ctx.shadowBlur = shadow.blur;
1477	};
1478
1479	/**
1480	 * @method _tick
1481	 * @param {Object} evtObj An event object that will be dispatched to all tick listeners. This object is reused between dispatchers to reduce construction &amp; GC costs.
1482	 * @protected
1483	 **/
1484	p._tick = function(evtObj) {
1485		// because tick can be really performance sensitive, check for listeners before calling dispatchEvent.
1486		var ls = this._listeners;
1487		if (ls &amp;&amp; ls[&quot;tick&quot;]) {
1488			// reset &amp; reuse the event object to avoid construction / GC costs:
1489			evtObj.target = null;
1490			evtObj.propagationStopped = evtObj.immediatePropagationStopped = false;
1491			this.dispatchEvent(evtObj);
1492		}
1493	};
1494
1495	/**
1496	 * @method _testHit
1497	 * @protected
1498	 * @param {CanvasRenderingContext2D} ctx
1499	 * @return {Boolean}
1500	 **/
1501	p._testHit = function(ctx) {
1502		try {
1503			var hit = ctx.getImageData(0, 0, 1, 1).data[3] &gt; 1;
1504		} catch (e) {
1505			if (!DisplayObject.suppressCrossDomainErrors) {
1506				throw &quot;An error has occurred. This is most likely due to security restrictions on reading canvas pixel data with local or cross-domain images.&quot;;
1507			}
1508		}
1509		return hit;
1510	};
1511
1512	/**
1513	 * @method _getBounds
1514	 * @param {Matrix2D} matrix
1515	 * @param {Boolean} ignoreTransform If true, does not apply this object&#x27;s transform.
1516	 * @return {Rectangle}
1517	 * @protected
1518	 **/
1519	p._getBounds = function(matrix, ignoreTransform){
1520		return this._transformBounds(this.getBounds(), matrix, ignoreTransform);
1521	};
1522
1523	/**
1524	 * @method _transformBounds
1525	 * @param {Rectangle} bounds
1526	 * @param {Matrix2D} matrix
1527	 * @param {Boolean} ignoreTransform
1528	 * @return {Rectangle}
1529	 * @protected
1530	 **/
1531	p._transformBounds = function(bounds, matrix, ignoreTransform) {
1532		if (!bounds) { return bounds; }
1533		var x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height, mtx = this._props.matrix;
1534		mtx = ignoreTransform ? mtx.identity() : this.getMatrix(mtx);
1535		
1536		if (x || y) { mtx.appendTransform(0,0,1,1,0,0,0,-x,-y); } // TODO: simplify this.
1537		if (matrix) { mtx.prependMatrix(matrix); }
1538		
1539		var x_a = width*mtx.a, x_b = width*mtx.b;
1540		var y_c = height*mtx.c, y_d = height*mtx.d;
1541		var tx = mtx.tx, ty = mtx.ty;
1542		
1543		var minX = tx, maxX = tx, minY = ty, maxY = ty;
1544
1545		if ((x = x_a + tx) &lt; minX) { minX = x; } else if (x &gt; maxX) { maxX = x; }
1546		if ((x = x_a + y_c + tx) &lt; minX) { minX = x; } else if (x &gt; maxX) { maxX = x; }
1547		if ((x = y_c + tx) &lt; minX) { minX = x; } else if (x &gt; maxX) { maxX = x; }
1548
1549		if ((y = x_b + ty) &lt; minY) { minY = y; } else if (y &gt; maxY) { maxY = y; }
1550		if ((y = x_b + y_d + ty) &lt; minY) { minY = y; } else if (y &gt; maxY) { maxY = y; }
1551		if ((y = y_d + ty) &lt; minY) { minY = y; } else if (y &gt; maxY) { maxY = y; }
1552
1553		return bounds.setValues(minX, minY, maxX-minX, maxY-minY);
1554	};
1555
1556	/**
1557	 * Indicates whether the display object has any mouse event listeners or a cursor.
1558	 * @method _isMouseOpaque
1559	 * @return {Boolean}
1560	 * @protected
1561	 **/
1562	p._hasMouseEventListener = function() {
1563		var evts = DisplayObject._MOUSE_EVENTS;
1564		for (var i= 0, l=evts.length; i&lt;l; i++) {
1565			if (this.hasEventListener(evts[i])) { return true; }
1566		}
1567		return !!this.cursor;
1568	};
1569
1570	createjs.DisplayObject = createjs.promote(DisplayObject, &quot;EventDispatcher&quot;);
1571}());
1572
1573    </pre>
1574</div>
1575
1576                    </div>
1577                </div>
1578            </div>
1579        </div>
1580    </div>
1581</div>
1582<script src="../assets/vendor/prettify/prettify-min.js"></script>
1583<script>prettyPrint();</script>
1584<script src="../assets/js/yui-prettify.js"></script>
1585<script src="../assets/../api.js"></script>
1586<script src="../assets/js/api-filter.js"></script>
1587<script src="../assets/js/api-list.js"></script>
1588<script src="../assets/js/api-search.js"></script>
1589<script src="../assets/js/apidocs.js"></script>
1590</body>
1591</html>