libraries/EaselJS_docs/classes/SpriteSheet.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 : SpriteSheet</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">
198 <h1>SpriteSheet Class</h1>
199<div class="box meta">
200
201
202
203 <div class="extends">
204 Extends <a href="../classes/EventDispatcher.html" class="crosslink">EventDispatcher</a>
205 </div>
206
207
208
209 <div class="foundat">
210 Defined in: <a href="../files/easeljs_display_SpriteSheet.js.html#l41"><code>SpriteSheet:41</code></a>
211 </div>
212
213
214
215
216 Module: <a href="../modules/EaselJS.html">EaselJS</a>
217
218
219
220
221</div>
222
223
224
225<div class="box intro">
226 <p>Encapsulates the properties and methods associated with a sprite sheet. A sprite sheet is a series of images (usually
227animation frames) combined into a larger image (or images). For example, an animation consisting of eight 100x100
228images could be combined into a single 400x200 sprite sheet (4 frames across by 2 high).</p>
229<p>The data passed to the SpriteSheet constructor defines:</p>
230<p><ol>
231 <li> The source image or images to use.</li>
232 <li> The positions of individual image frames.</li>
233 <li> Sequences of frames that form named animations. Optional.</li>
234 <li> The target playback framerate. Optional.</li>
235</ol></p>
236<p><h3>SpriteSheet Format</h3>
237SpriteSheets are an object with two required properties (<code>images</code> and <code>frames</code>), and two optional properties
238(<code>framerate</code> and <code>animations</code>). This makes them easy to define in javascript code, or in JSON.</p>
239<p><h4>images</h4>
240An array of source images. Images can be either an HTMlimage
241instance, or a uri to an image. The former is recommended to control preloading.</p>
242<pre class="code prettyprint"><code>images: [image1, "path/to/image2.png"],</code></pre>
243<p><h4>frames</h4>
244Defines the individual frames. There are two supported formats for frame data:
245When all of the frames are the same size (in a grid), use an object with <code>width</code>, <code>height</code>, <code>regX</code>, <code>regY</code>,
246and <code>count</code> properties.</p>
247<ul>
248 <li><code>width</code> & <code>height</code> are required and specify the dimensions of the frames</li>
249 <li><code>regX</code> & <code>regY</code> indicate the registration point or "origin" of the frames</li>
250 <li><code>spacing</code> indicate the spacing between frames</li>
251 <li><code>margin</code> specify the margin around the image(s)</li>
252 <li><code>count</code> allows you to specify the total number of frames in the spritesheet; if omitted, this will
253 be calculated based on the dimensions of the source images and the frames. Frames will be assigned
254 indexes based on their position in the source images (left to right, top to bottom).</li>
255</ul>
256
257<pre class="code prettyprint"><code> frames: {width:64, height:64, count:20, regX: 32, regY:64, spacing:0, margin:0}</code></pre>
258<p>If the frames are of different sizes, use an array of frame definitions. Each definition is itself an array
259with 4 required and 3 optional entries, in the order:</p>
260<ul>
261 <li>The first four, <code>x</code>, <code>y</code>, <code>width</code>, and <code>height</code> are required and define the frame rectangle.</li>
262 <li>The fifth, <code>imageIndex</code>, specifies the index of the source image (defaults to 0)</li>
263 <li>The last two, <code>regX</code> and <code>regY</code> specify the registration point of the frame</li>
264</ul>
265
266<pre class="code prettyprint"><code>frames: [
267 // x, y, width, height, imageIndex*, regX*, regY*
268 [64, 0, 96, 64],
269 [0, 0, 64, 64, 1, 32, 32]
270 // etc.
271]</code></pre>
272<p><h4>animations</h4>
273Optional. An object defining sequences of frames to play as named animations. Each property corresponds to an
274animation of the same name. Each animation must specify the frames to play, and may
275also include a relative playback <code>speed</code> (ex. 2 would playback at double speed, 0.5 at half), and
276the name of the <code>next</code> animation to sequence to after it completes.</p>
277<p>There are three formats supported for defining the frames in an animation, which can be mixed and matched as appropriate:</p>
278<p><ol>
279 <li>for a single frame animation, you can simply specify the frame index</p>
280<pre class="code prettyprint"><code> animations: {
281 sit: 7
282 }</code></pre>
283<p></li></p>
284<p><li>
285 for an animation of consecutive frames, you can use an array with two required, and two optional entries
286 in the order: <code>start</code>, <code>end</code>, <code>next</code>, and <code>speed</code>. This will play the frames from start to end inclusive.</p>
287<pre class="code prettyprint"><code> animations: {
288 // start, end, next*, speed*
289 run: [0, 8],
290 jump: [9, 12, "run", 2]
291 }</code></pre>
292<p> </li>
293 <li>
294 for non-consecutive frames, you can use an object with a <code>frames</code> property defining an array of frame
295 indexes to play in order. The object can also specify <code>next</code> and <code>speed</code> properties.</p>
296<pre class="code prettyprint"><code> animations: {
297 walk: {
298 frames: [1,2,3,3,2,1]
299 },
300 shoot: {
301 frames: [1,4,5,6],
302 next: "walk",
303 speed: 0.5
304 }
305 }</code></pre>
306<p> </li>
307</ol>
308<strong>Note:</strong> the <code>speed</code> property was added in EaselJS 0.7.0. Earlier versions had a <code>frequency</code>
309property instead, which was the inverse of <code>speed</code>. For example, a value of "4" would be 1/4 normal speed in
310earlier versions, but is 4x normal speed in EaselJS 0.7.0+.</p>
311<p><h4>framerate</h4>
312Optional. Indicates the default framerate to play this spritesheet at in frames per second. See
313<a href="../classes/SpriteSheet.html#property_framerate" class="crosslink">framerate</a> for more information.</p>
314<pre class="code prettyprint"><code> framerate: 20</code></pre>
315<p>Note that the Sprite framerate will only work if the stage update method is provided with the <a href="../classes/Ticker.html#event_tick" class="crosslink">tick</a>
316event generated by the <a href="../classes/Ticker.html" class="crosslink">Ticker</a>.</p>
317<pre class="code prettyprint"><code> createjs.Ticker.on("tick", handleTick);
318 function handleTick(event) {
319 stage.update(event);
320 }</code></pre>
321<p><h3>Example</h3>
322To define a simple sprite sheet, with a single image "sprites.jpg" arranged in a regular 50x50 grid with three
323animations: "stand" showing the first frame, "run" looping frame 1-5 inclusive, and "jump" playing frame 6-8 and
324sequencing back to run.</p>
325<pre class="code prettyprint"><code> var data = {
326 images: ["sprites.jpg"],
327 frames: {width:50, height:50},
328 animations: {
329 stand:0,
330 run:[1,5],
331 jump:[6,8,"run"]
332 }
333 };
334 var spriteSheet = new createjs.SpriteSheet(data);
335 var animation = new createjs.Sprite(spriteSheet, "run");</code></pre>
336<p><h3>Generating SpriteSheet Images</h3>
337Spritesheets can be created manually by combining images in PhotoShop, and specifying the frame size or
338coordinates manually, however there are a number of tools that facilitate this.</p>
339<ul>
340 <li>Exporting SpriteSheets or HTML5 content from Adobe Flash/Animate supports the EaselJS SpriteSheet format.</li>
341 <li>The popular <a href="https://www.codeandweb.com/texturepacker/easeljs" target="_blank">Texture Packer</a> has
342 EaselJS support.
343 <li>SWF animations in Adobe Flash/Animate can be exported to SpriteSheets using <a href="http://createjs.com/zoe" target="_blank">Zoë</a></li>
344</ul>
345
346<p><h3>Cross Origin Issues</h3>
347<strong>Warning:</strong> Images loaded cross-origin will throw cross-origin security errors when interacted with
348using:</p>
349<p><ul>
350 <li>a mouse</li>
351 <li>methods such as <a href="../classes/Container.html#method_getObjectUnderPoint" class="crosslink">getObjectUnderPoint</a></li>
352 <li>Filters (see <a href="../classes/Filter.html" class="crosslink">Filter</a>)</li>
353 <li>caching (see <a href="../classes/DisplayObject.html#method_cache" class="crosslink">cache</a>)</li>
354</ul>
355You can get around this by setting <code>crossOrigin</code> property on your images before passing them to EaselJS, or
356setting the <code>crossOrigin</code> property on PreloadJS' LoadQueue or LoadItems.</p>
357<pre class="code prettyprint"><code> var image = new Image();
358 img.crossOrigin="Anonymous";
359 img.src = "http://server-with-CORS-support.com/path/to/image.jpg";</code></pre>
360<p>If you pass string paths to SpriteSheets, they will not work cross-origin. The server that stores the image must
361support cross-origin requests, or this will not work. For more information, check out
362<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS" target="_blank">CORS overview on MDN</a>.</p>
363
364</div>
365
366
367 <div class="constructor">
368 <h2>Constructor</h2>
369 <div id="method_SpriteSheet" class="method item">
370 <h3 class="name"><code>SpriteSheet</code></h3>
371
372
373 <div class="args">
374 <span class="paren">(</span><ul class="args-list inline commas">
375
376 <li class="arg">
377
378 <code>data</code>
379
380 </li>
381
382 </ul><span class="paren">)</span>
383 </div>
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400 <div class="meta">
401
402
403
404 <p>
405
406 Defined in
407
408
409
410
411 <a href="../files/easeljs_display_SpriteSheet.js.html#l41"><code>SpriteSheet:41</code></a>
412
413 </p>
414
415
416
417
418
419 </div>
420
421 <div class="description">
422
423 </div>
424
425
426 <div class="params">
427 <h4>Parameters:</h4>
428
429 <ul class="params-list">
430
431 <li class="param">
432
433 <code class="param-name">data</code>
434 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
435
436
437
438
439 <div class="param-description">
440 <p>An object describing the SpriteSheet data.</p>
441
442 </div>
443
444
445 </li>
446
447 </ul>
448 </div>
449
450
451
452
453
454</div>
455
456 </div>
457
458
459<div id="classdocs" class="tabview">
460 <ul class="api-class-tabs">
461 <li class="api-class-tab index"><a href="#index">Index</a></li>
462
463
464 <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
465
466
467 <li class="api-class-tab properties"><a href="#properties">Properties</a></li>
468
469
470
471 <li class="api-class-tab events"><a href="#events">Events</a></li>
472
473 </ul>
474
475 <div>
476 <div id="index" class="api-class-tabpanel index">
477 <h2 class="off-left">Item Index</h2>
478
479
480 <div class="index-section methods">
481 <h3>Methods</h3>
482
483 <ul class="index-list methods extends">
484
485 <li class="index-item method protected">
486 <a href="#method__calculateFrames">_calculateFrames</a>
487
488
489
490 </li>
491
492 <li class="index-item method protected inherited">
493 <a href="#method__dispatchEvent">_dispatchEvent</a>
494
495
496
497 </li>
498
499 <li class="index-item method protected">
500 <a href="#method__getAnimations">_getAnimations</a>
501
502
503
504 </li>
505
506 <li class="index-item method protected">
507 <a href="#method__handleImageError">_handleImageError</a>
508
509
510
511 </li>
512
513 <li class="index-item method protected">
514 <a href="#method__handleImageLoad">_handleImageLoad</a>
515
516
517
518 </li>
519
520 <li class="index-item method protected">
521 <a href="#method__parseData">_parseData</a>
522
523
524
525 </li>
526
527 <li class="index-item method inherited">
528 <a href="#method_addEventListener">addEventListener</a>
529
530
531
532 </li>
533
534 <li class="index-item method">
535 <a href="#method_clone">clone</a>
536
537
538
539 </li>
540
541 <li class="index-item method inherited">
542 <a href="#method_dispatchEvent">dispatchEvent</a>
543
544
545
546 </li>
547
548 <li class="index-item method">
549 <a href="#method_getAnimation">getAnimation</a>
550
551
552
553 </li>
554
555 <li class="index-item method">
556 <a href="#method_getFrame">getFrame</a>
557
558
559
560 </li>
561
562 <li class="index-item method">
563 <a href="#method_getFrameBounds">getFrameBounds</a>
564
565
566
567 </li>
568
569 <li class="index-item method">
570 <a href="#method_getNumFrames">getNumFrames</a>
571
572
573
574 </li>
575
576 <li class="index-item method inherited">
577 <a href="#method_hasEventListener">hasEventListener</a>
578
579
580
581 </li>
582
583 <li class="index-item method inherited">
584 <a href="#method_off">off</a>
585
586
587
588 </li>
589
590 <li class="index-item method inherited">
591 <a href="#method_on">on</a>
592
593
594
595 </li>
596
597 <li class="index-item method inherited">
598 <a href="#method_removeAllEventListeners">removeAllEventListeners</a>
599
600
601
602 </li>
603
604 <li class="index-item method inherited">
605 <a href="#method_removeEventListener">removeEventListener</a>
606
607
608
609 </li>
610
611 <li class="index-item method inherited">
612 <a href="#method_toString">toString</a>
613
614
615
616 </li>
617
618 <li class="index-item method inherited">
619 <a href="#method_willTrigger">willTrigger</a>
620
621
622
623 </li>
624
625 </ul>
626 </div>
627
628
629
630 <div class="index-section properties">
631 <h3>Properties</h3>
632
633 <ul class="index-list properties extends">
634
635 <li class="index-item property protected">
636 <a href="#property__animations">_animations</a>
637
638
639
640 </li>
641
642 <li class="index-item property protected inherited">
643 <a href="#property__captureListeners">_captureListeners</a>
644
645
646
647 </li>
648
649 <li class="index-item property protected">
650 <a href="#property__data">_data</a>
651
652
653
654 </li>
655
656 <li class="index-item property protected">
657 <a href="#property__frameHeight">_frameHeight</a>
658
659
660
661 </li>
662
663 <li class="index-item property protected">
664 <a href="#property__frames">_frames</a>
665
666
667
668 </li>
669
670 <li class="index-item property protected">
671 <a href="#property__frameWidth">_frameWidth</a>
672
673
674
675 </li>
676
677 <li class="index-item property protected">
678 <a href="#property__images">_images</a>
679
680
681
682 </li>
683
684 <li class="index-item property protected inherited">
685 <a href="#property__listeners">_listeners</a>
686
687
688
689 </li>
690
691 <li class="index-item property protected">
692 <a href="#property__loadCount">_loadCount</a>
693
694
695
696 </li>
697
698 <li class="index-item property protected">
699 <a href="#property__margin">_margin</a>
700
701
702
703 </li>
704
705 <li class="index-item property protected">
706 <a href="#property__numFrames">_numFrames</a>
707
708
709
710 </li>
711
712 <li class="index-item property protected">
713 <a href="#property__regX">_regX</a>
714
715
716
717 </li>
718
719 <li class="index-item property protected">
720 <a href="#property__regY">_regY</a>
721
722
723
724 </li>
725
726 <li class="index-item property protected">
727 <a href="#property__spacing">_spacing</a>
728
729
730
731 </li>
732
733 <li class="index-item property">
734 <a href="#property_animations">animations</a>
735
736
737
738 </li>
739
740 <li class="index-item property">
741 <a href="#property_complete">complete</a>
742
743
744
745 </li>
746
747 <li class="index-item property">
748 <a href="#property_framerate">framerate</a>
749
750
751
752 </li>
753
754 </ul>
755 </div>
756
757
758
759
760
761 <div class="index-section events">
762 <h3>Events</h3>
763
764 <ul class="index-list events extends">
765
766 <li class="index-item event">
767 <a href="#event_complete">complete</a>
768
769
770
771 </li>
772
773 <li class="index-item event">
774 <a href="#event_error">error</a>
775
776
777
778 </li>
779
780 <li class="index-item event">
781 <a href="#event_getframe">getframe</a>
782
783
784
785 </li>
786
787 </ul>
788 </div>
789
790 </div>
791
792
793 <div id="methods" class="api-class-tabpanel">
794 <h2 class="off-left">Methods</h2>
795
796
797 <div id="method__calculateFrames" class="method item protected">
798 <h3 class="name"><code>_calculateFrames</code></h3>
799
800
801 <span class="paren">()</span>
802
803
804
805
806
807
808
809 <span class="flag protected">protected</span>
810
811
812
813
814
815
816
817
818
819
820 <div class="meta">
821
822
823
824 <p>
825
826 Defined in
827
828
829
830
831 <a href="../files/easeljs_display_SpriteSheet.js.html#l588"><code>_calculateFrames:588</code></a>
832
833 </p>
834
835
836
837
838
839 </div>
840
841 <div class="description">
842
843 </div>
844
845
846
847
848
849
850</div>
851
852
853 <div id="method__dispatchEvent" class="method item protected inherited">
854 <h3 class="name"><code>_dispatchEvent</code></h3>
855
856
857 <div class="args">
858 <span class="paren">(</span><ul class="args-list inline commas">
859
860 <li class="arg">
861
862 <code>eventObj</code>
863
864 </li>
865
866 <li class="arg">
867
868 <code>eventPhase</code>
869
870 </li>
871
872 </ul><span class="paren">)</span>
873 </div>
874
875
876
877
878
879
880
881 <span class="flag protected">protected</span>
882
883
884
885
886
887
888
889
890
891
892 <div class="meta">
893
894
895 <p>Inherited from
896 <a href="../classes/EventDispatcher.html#method__dispatchEvent">EventDispatcher</a>:
897
898
899
900 <a href="../files/createjs_events_EventDispatcher.js.html#l380"><code>_dispatchEvent:380</code></a>
901
902 </p>
903
904
905
906
907
908 </div>
909
910 <div class="description">
911
912 </div>
913
914
915 <div class="params">
916 <h4>Parameters:</h4>
917
918 <ul class="params-list">
919
920 <li class="param">
921
922 <code class="param-name">eventObj</code>
923 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a> | <a href="../classes/Event.html" class="crosslink">Event</a></span>
924
925
926
927
928 <div class="param-description">
929
930 </div>
931
932
933 </li>
934
935 <li class="param">
936
937 <code class="param-name">eventPhase</code>
938 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
939
940
941
942
943 <div class="param-description">
944
945 </div>
946
947
948 </li>
949
950 </ul>
951 </div>
952
953
954
955
956
957</div>
958
959
960 <div id="method__getAnimations" class="method item protected">
961 <h3 class="name"><code>_getAnimations</code></h3>
962
963
964 <span class="paren">()</span>
965
966
967
968 <span class="returns-inline">
969 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array" class="crosslink external" target="_blank">Array</a></span>
970 </span>
971
972
973
974
975
976 <span class="flag protected">protected</span>
977
978
979
980
981
982
983
984
985
986
987 <div class="meta">
988
989
990
991 <p>
992
993 Defined in
994
995
996
997
998 <a href="../files/easeljs_display_SpriteSheet.js.html#l363"><code>_getAnimations:363</code></a>
999
1000 </p>
1001
1002
1003
1004
1005
1006 </div>
1007
1008 <div class="description">
1009 <p>Use the <a href="../classes/SpriteSheet.html#property_animations" class="crosslink">animations</a> property instead.</p>
1010
1011 </div>
1012
1013
1014
1015
1016 <div class="returns">
1017 <h4>Returns:</h4>
1018
1019 <div class="returns-description">
1020
1021
1022 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array" class="crosslink external" target="_blank">Array</a></span>:
1023
1024
1025 </div>
1026 </div>
1027
1028
1029
1030</div>
1031
1032
1033 <div id="method__handleImageError" class="method item protected">
1034 <h3 class="name"><code>_handleImageError</code></h3>
1035
1036
1037 <span class="paren">()</span>
1038
1039
1040
1041
1042
1043
1044
1045 <span class="flag protected">protected</span>
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056 <div class="meta">
1057
1058
1059
1060 <p>
1061
1062 Defined in
1063
1064
1065
1066
1067 <a href="../files/easeljs_display_SpriteSheet.js.html#l573"><code>_handleImageError:573</code></a>
1068
1069 </p>
1070
1071
1072
1073
1074
1075 </div>
1076
1077 <div class="description">
1078
1079 </div>
1080
1081
1082
1083
1084
1085
1086</div>
1087
1088
1089 <div id="method__handleImageLoad" class="method item protected">
1090 <h3 class="name"><code>_handleImageLoad</code></h3>
1091
1092
1093 <span class="paren">()</span>
1094
1095
1096
1097
1098
1099
1100
1101 <span class="flag protected">protected</span>
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112 <div class="meta">
1113
1114
1115
1116 <p>
1117
1118 Defined in
1119
1120
1121
1122
1123 <a href="../files/easeljs_display_SpriteSheet.js.html#l561"><code>_handleImageLoad:561</code></a>
1124
1125 </p>
1126
1127
1128
1129
1130
1131 </div>
1132
1133 <div class="description">
1134
1135 </div>
1136
1137
1138
1139
1140
1141
1142</div>
1143
1144
1145 <div id="method__parseData" class="method item protected">
1146 <h3 class="name"><code>_parseData</code></h3>
1147
1148
1149 <div class="args">
1150 <span class="paren">(</span><ul class="args-list inline commas">
1151
1152 <li class="arg">
1153
1154 <code>data</code>
1155
1156 </li>
1157
1158 </ul><span class="paren">)</span>
1159 </div>
1160
1161
1162
1163
1164
1165
1166
1167 <span class="flag protected">protected</span>
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178 <div class="meta">
1179
1180
1181
1182 <p>
1183
1184 Defined in
1185
1186
1187
1188
1189 <a href="../files/easeljs_display_SpriteSheet.js.html#l474"><code>_parseData:474</code></a>
1190
1191 </p>
1192
1193
1194
1195
1196
1197 </div>
1198
1199 <div class="description">
1200
1201 </div>
1202
1203
1204 <div class="params">
1205 <h4>Parameters:</h4>
1206
1207 <ul class="params-list">
1208
1209 <li class="param">
1210
1211 <code class="param-name">data</code>
1212 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
1213
1214
1215
1216
1217 <div class="param-description">
1218 <p>An object describing the SpriteSheet data.</p>
1219
1220 </div>
1221
1222
1223 </li>
1224
1225 </ul>
1226 </div>
1227
1228
1229
1230
1231
1232</div>
1233
1234
1235 <div id="method_addEventListener" class="method item inherited">
1236 <h3 class="name"><code>addEventListener</code></h3>
1237
1238
1239 <div class="args">
1240 <span class="paren">(</span><ul class="args-list inline commas">
1241
1242 <li class="arg">
1243
1244 <code>type</code>
1245
1246 </li>
1247
1248 <li class="arg">
1249
1250 <code>listener</code>
1251
1252 </li>
1253
1254 <li class="arg">
1255
1256 <code class="optional">[useCapture]</code>
1257
1258 </li>
1259
1260 </ul><span class="paren">)</span>
1261 </div>
1262
1263
1264
1265 <span class="returns-inline">
1266 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
1267 </span>
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282 <div class="meta">
1283
1284
1285 <p>Inherited from
1286 <a href="../classes/EventDispatcher.html#method_addEventListener">EventDispatcher</a>:
1287
1288
1289
1290 <a href="../files/createjs_events_EventDispatcher.js.html#l140"><code>addEventListener:140</code></a>
1291
1292 </p>
1293
1294
1295
1296
1297
1298 </div>
1299
1300 <div class="description">
1301 <p><p>Adds the specified event listener. Note that adding multiple listeners to the same function will result in
1302multiple callbacks getting fired.</p></p>
1303<h4>Example</h4>
1304
1305<pre class="code prettyprint"><code> displayObject.addEventListener("click", handleClick);
1306 function handleClick(event) {
1307 // Click happened.
1308 }</code></pre>
1309
1310 </div>
1311
1312
1313 <div class="params">
1314 <h4>Parameters:</h4>
1315
1316 <ul class="params-list">
1317
1318 <li class="param">
1319
1320 <code class="param-name">type</code>
1321 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
1322
1323
1324
1325
1326 <div class="param-description">
1327 <p>The string type of the event.</p>
1328
1329 </div>
1330
1331
1332 </li>
1333
1334 <li class="param">
1335
1336 <code class="param-name">listener</code>
1337 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
1338
1339
1340
1341
1342 <div class="param-description">
1343 <p>An object with a handleEvent method, or a function that will be called when
1344the event is dispatched.</p>
1345
1346 </div>
1347
1348
1349 </li>
1350
1351 <li class="param">
1352
1353 <code class="param-name optional">[useCapture]</code>
1354 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
1355 <span class="flag optional" title="This parameter is optional.">optional</span>
1356
1357
1358
1359
1360 <div class="param-description">
1361 <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
1362
1363 </div>
1364
1365
1366 </li>
1367
1368 </ul>
1369 </div>
1370
1371
1372
1373 <div class="returns">
1374 <h4>Returns:</h4>
1375
1376 <div class="returns-description">
1377
1378
1379 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>:
1380
1381 <p>Returns the listener for chaining or assignment.</p>
1382
1383
1384 </div>
1385 </div>
1386
1387
1388
1389</div>
1390
1391
1392 <div id="method_clone" class="method item">
1393 <h3 class="name"><code>clone</code></h3>
1394
1395
1396 <span class="paren">()</span>
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413 <div class="meta">
1414
1415
1416
1417 <p>
1418
1419 Defined in
1420
1421
1422
1423
1424 <a href="../files/easeljs_display_SpriteSheet.js.html#l465"><code>clone:465</code></a>
1425
1426 </p>
1427
1428
1429
1430
1431
1432 </div>
1433
1434 <div class="description">
1435 <p>SpriteSheet cannot be cloned. A SpriteSheet can be shared by multiple Sprite instances without cloning it.</p>
1436
1437 </div>
1438
1439
1440
1441
1442
1443
1444</div>
1445
1446
1447 <div id="method_dispatchEvent" class="method item inherited">
1448 <h3 class="name"><code>dispatchEvent</code></h3>
1449
1450
1451 <div class="args">
1452 <span class="paren">(</span><ul class="args-list inline commas">
1453
1454 <li class="arg">
1455
1456 <code>eventObj</code>
1457
1458 </li>
1459
1460 <li class="arg">
1461
1462 <code class="optional">[bubbles]</code>
1463
1464 </li>
1465
1466 <li class="arg">
1467
1468 <code class="optional">[cancelable]</code>
1469
1470 </li>
1471
1472 </ul><span class="paren">)</span>
1473 </div>
1474
1475
1476
1477 <span class="returns-inline">
1478 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
1479 </span>
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494 <div class="meta">
1495
1496
1497 <p>Inherited from
1498 <a href="../classes/EventDispatcher.html#method_dispatchEvent">EventDispatcher</a>:
1499
1500
1501
1502 <a href="../files/createjs_events_EventDispatcher.js.html#l285"><code>dispatchEvent:285</code></a>
1503
1504 </p>
1505
1506
1507
1508
1509
1510 </div>
1511
1512 <div class="description">
1513 <p><p>Dispatches the specified event to all listeners.</p></p>
1514<h4>Example</h4>
1515
1516<pre class="code prettyprint"><code> // Use a string event
1517 this.dispatchEvent("complete");
1518
1519 // Use an Event instance
1520 var event = new createjs.Event("progress");
1521 this.dispatchEvent(event);</code></pre>
1522
1523 </div>
1524
1525
1526 <div class="params">
1527 <h4>Parameters:</h4>
1528
1529 <ul class="params-list">
1530
1531 <li class="param">
1532
1533 <code class="param-name">eventObj</code>
1534 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a> | <a href="../classes/Event.html" class="crosslink">Event</a></span>
1535
1536
1537
1538
1539 <div class="param-description">
1540 <p>An object with a "type" property, or a string type.
1541While a generic object will work, it is recommended to use a CreateJS Event instance. If a string is used,
1542dispatchEvent will construct an Event instance if necessary with the specified type. This latter approach can
1543be used to avoid event object instantiation for non-bubbling events that may not have any listeners.</p>
1544
1545 </div>
1546
1547
1548 </li>
1549
1550 <li class="param">
1551
1552 <code class="param-name optional">[bubbles]</code>
1553 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
1554 <span class="flag optional" title="This parameter is optional.">optional</span>
1555
1556
1557
1558
1559 <div class="param-description">
1560 <p>Specifies the <code>bubbles</code> value when a string was passed to eventObj.</p>
1561
1562 </div>
1563
1564
1565 </li>
1566
1567 <li class="param">
1568
1569 <code class="param-name optional">[cancelable]</code>
1570 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
1571 <span class="flag optional" title="This parameter is optional.">optional</span>
1572
1573
1574
1575
1576 <div class="param-description">
1577 <p>Specifies the <code>cancelable</code> value when a string was passed to eventObj.</p>
1578
1579 </div>
1580
1581
1582 </li>
1583
1584 </ul>
1585 </div>
1586
1587
1588
1589 <div class="returns">
1590 <h4>Returns:</h4>
1591
1592 <div class="returns-description">
1593
1594
1595 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>:
1596
1597 <p>Returns false if <code>preventDefault()</code> was called on a cancelable event, true otherwise.</p>
1598
1599
1600 </div>
1601 </div>
1602
1603
1604
1605</div>
1606
1607
1608 <div id="method_getAnimation" class="method item">
1609 <h3 class="name"><code>getAnimation</code></h3>
1610
1611
1612 <div class="args">
1613 <span class="paren">(</span><ul class="args-list inline commas">
1614
1615 <li class="arg">
1616
1617 <code>name</code>
1618
1619 </li>
1620
1621 </ul><span class="paren">)</span>
1622 </div>
1623
1624
1625
1626 <span class="returns-inline">
1627 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
1628 </span>
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643 <div class="meta">
1644
1645
1646
1647 <p>
1648
1649 Defined in
1650
1651
1652
1653
1654 <a href="../files/easeljs_display_SpriteSheet.js.html#l407"><code>getAnimation:407</code></a>
1655
1656 </p>
1657
1658
1659
1660
1661
1662 </div>
1663
1664 <div class="description">
1665 <p>Returns an object defining the specified animation. The returned object contains:<UL>
1666 <li>frames: an array of the frame ids in the animation</li>
1667 <li>speed: the playback speed for this animation</li>
1668 <li>name: the name of the animation</li>
1669 <li>next: the default animation to play next. If the animation loops, the name and next property will be the
1670 same.</li>
1671</UL></p>
1672
1673 </div>
1674
1675
1676 <div class="params">
1677 <h4>Parameters:</h4>
1678
1679 <ul class="params-list">
1680
1681 <li class="param">
1682
1683 <code class="param-name">name</code>
1684 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
1685
1686
1687
1688
1689 <div class="param-description">
1690 <p>The name of the animation to get.</p>
1691
1692 </div>
1693
1694
1695 </li>
1696
1697 </ul>
1698 </div>
1699
1700
1701
1702 <div class="returns">
1703 <h4>Returns:</h4>
1704
1705 <div class="returns-description">
1706
1707
1708 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>:
1709
1710 <p>a generic object with frames, speed, name, and next properties.</p>
1711
1712
1713 </div>
1714 </div>
1715
1716
1717
1718</div>
1719
1720
1721 <div id="method_getFrame" class="method item">
1722 <h3 class="name"><code>getFrame</code></h3>
1723
1724
1725 <div class="args">
1726 <span class="paren">(</span><ul class="args-list inline commas">
1727
1728 <li class="arg">
1729
1730 <code>frameIndex</code>
1731
1732 </li>
1733
1734 </ul><span class="paren">)</span>
1735 </div>
1736
1737
1738
1739 <span class="returns-inline">
1740 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
1741 </span>
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756 <div class="meta">
1757
1758
1759
1760 <p>
1761
1762 Defined in
1763
1764
1765
1766
1767 <a href="../files/easeljs_display_SpriteSheet.js.html#l423"><code>getFrame:423</code></a>
1768
1769 </p>
1770
1771
1772
1773
1774
1775 </div>
1776
1777 <div class="description">
1778 <p>Returns an object specifying the image and source rect of the specified frame. The returned object has:<UL>
1779 <li>an image property holding a reference to the image object in which the frame is found</li>
1780 <li>a rect property containing a Rectangle instance which defines the boundaries for the frame within that
1781 image.</li>
1782 <li> A regX and regY property corresponding to the regX/Y values for the frame.
1783</UL></p>
1784
1785 </div>
1786
1787
1788 <div class="params">
1789 <h4>Parameters:</h4>
1790
1791 <ul class="params-list">
1792
1793 <li class="param">
1794
1795 <code class="param-name">frameIndex</code>
1796 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
1797
1798
1799
1800
1801 <div class="param-description">
1802 <p>The index of the frame.</p>
1803
1804 </div>
1805
1806
1807 </li>
1808
1809 </ul>
1810 </div>
1811
1812
1813
1814 <div class="returns">
1815 <h4>Returns:</h4>
1816
1817 <div class="returns-description">
1818
1819
1820 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>:
1821
1822 <p>a generic object with image and rect properties. Returns null if the frame does not exist.</p>
1823
1824
1825 </div>
1826 </div>
1827
1828
1829
1830</div>
1831
1832
1833 <div id="method_getFrameBounds" class="method item">
1834 <h3 class="name"><code>getFrameBounds</code></h3>
1835
1836
1837 <div class="args">
1838 <span class="paren">(</span><ul class="args-list inline commas">
1839
1840 <li class="arg">
1841
1842 <code>frameIndex</code>
1843
1844 </li>
1845
1846 <li class="arg">
1847
1848 <code class="optional">[rectangle]</code>
1849
1850 </li>
1851
1852 </ul><span class="paren">)</span>
1853 </div>
1854
1855
1856
1857 <span class="returns-inline">
1858 <span class="type"><a href="../classes/Rectangle.html" class="crosslink">Rectangle</a></span>
1859 </span>
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874 <div class="meta">
1875
1876
1877
1878 <p>
1879
1880 Defined in
1881
1882
1883
1884
1885 <a href="../files/easeljs_display_SpriteSheet.js.html#l440"><code>getFrameBounds:440</code></a>
1886
1887 </p>
1888
1889
1890
1891
1892
1893 </div>
1894
1895 <div class="description">
1896 <p>Returns a <a href="../classes/Rectangle.html" class="crosslink">Rectangle</a> instance defining the bounds of the specified frame relative
1897to the origin. For example, a 90 x 70 frame with a regX of 50 and a regY of 40 would return:</p>
1898<pre class="code prettyprint"><code>[x=-50, y=-40, width=90, height=70]</code></pre>
1899
1900 </div>
1901
1902
1903 <div class="params">
1904 <h4>Parameters:</h4>
1905
1906 <ul class="params-list">
1907
1908 <li class="param">
1909
1910 <code class="param-name">frameIndex</code>
1911 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
1912
1913
1914
1915
1916 <div class="param-description">
1917 <p>The index of the frame.</p>
1918
1919 </div>
1920
1921
1922 </li>
1923
1924 <li class="param">
1925
1926 <code class="param-name optional">[rectangle]</code>
1927 <span class="type"><a href="../classes/Rectangle.html" class="crosslink">Rectangle</a></span>
1928 <span class="flag optional" title="This parameter is optional.">optional</span>
1929
1930
1931
1932
1933 <div class="param-description">
1934 <p>A Rectangle instance to copy the values into. By default a new instance is created.</p>
1935
1936 </div>
1937
1938
1939 </li>
1940
1941 </ul>
1942 </div>
1943
1944
1945
1946 <div class="returns">
1947 <h4>Returns:</h4>
1948
1949 <div class="returns-description">
1950
1951
1952 <span class="type"><a href="../classes/Rectangle.html" class="crosslink">Rectangle</a></span>:
1953
1954 <p>A Rectangle instance. Returns null if the frame does not exist, or the image is not fully loaded.</p>
1955
1956
1957 </div>
1958 </div>
1959
1960
1961
1962</div>
1963
1964
1965 <div id="method_getNumFrames" class="method item">
1966 <h3 class="name"><code>getNumFrames</code></h3>
1967
1968
1969 <div class="args">
1970 <span class="paren">(</span><ul class="args-list inline commas">
1971
1972 <li class="arg">
1973
1974 <code>animation</code>
1975
1976 </li>
1977
1978 </ul><span class="paren">)</span>
1979 </div>
1980
1981
1982
1983 <span class="returns-inline">
1984 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
1985 </span>
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000 <div class="meta">
2001
2002
2003
2004 <p>
2005
2006 Defined in
2007
2008
2009
2010
2011 <a href="../files/easeljs_display_SpriteSheet.js.html#l389"><code>getNumFrames:389</code></a>
2012
2013 </p>
2014
2015
2016
2017
2018
2019 </div>
2020
2021 <div class="description">
2022 <p>Returns the total number of frames in the specified animation, or in the whole sprite
2023sheet if the animation param is omitted. Returns 0 if the spritesheet relies on calculated frame counts, and
2024the images have not been fully loaded.</p>
2025
2026 </div>
2027
2028
2029 <div class="params">
2030 <h4>Parameters:</h4>
2031
2032 <ul class="params-list">
2033
2034 <li class="param">
2035
2036 <code class="param-name">animation</code>
2037 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2038
2039
2040
2041
2042 <div class="param-description">
2043 <p>The name of the animation to get a frame count for.</p>
2044
2045 </div>
2046
2047
2048 </li>
2049
2050 </ul>
2051 </div>
2052
2053
2054
2055 <div class="returns">
2056 <h4>Returns:</h4>
2057
2058 <div class="returns-description">
2059
2060
2061 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>:
2062
2063 <p>The number of frames in the animation, or in the entire sprite sheet if the animation param is omitted.</p>
2064
2065
2066 </div>
2067 </div>
2068
2069
2070
2071</div>
2072
2073
2074 <div id="method_hasEventListener" class="method item inherited">
2075 <h3 class="name"><code>hasEventListener</code></h3>
2076
2077
2078 <div class="args">
2079 <span class="paren">(</span><ul class="args-list inline commas">
2080
2081 <li class="arg">
2082
2083 <code>type</code>
2084
2085 </li>
2086
2087 </ul><span class="paren">)</span>
2088 </div>
2089
2090
2091
2092 <span class="returns-inline">
2093 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2094 </span>
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109 <div class="meta">
2110
2111
2112 <p>Inherited from
2113 <a href="../classes/EventDispatcher.html#method_hasEventListener">EventDispatcher</a>:
2114
2115
2116
2117 <a href="../files/createjs_events_EventDispatcher.js.html#l339"><code>hasEventListener:339</code></a>
2118
2119 </p>
2120
2121
2122
2123
2124
2125 </div>
2126
2127 <div class="description">
2128 <p>Indicates whether there is at least one listener for the specified event type.</p>
2129
2130 </div>
2131
2132
2133 <div class="params">
2134 <h4>Parameters:</h4>
2135
2136 <ul class="params-list">
2137
2138 <li class="param">
2139
2140 <code class="param-name">type</code>
2141 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2142
2143
2144
2145
2146 <div class="param-description">
2147 <p>The string type of the event.</p>
2148
2149 </div>
2150
2151
2152 </li>
2153
2154 </ul>
2155 </div>
2156
2157
2158
2159 <div class="returns">
2160 <h4>Returns:</h4>
2161
2162 <div class="returns-description">
2163
2164
2165 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>:
2166
2167 <p>Returns true if there is at least one listener for the specified event.</p>
2168
2169
2170 </div>
2171 </div>
2172
2173
2174
2175</div>
2176
2177
2178 <div id="method_off" class="method item inherited">
2179 <h3 class="name"><code>off</code></h3>
2180
2181
2182 <div class="args">
2183 <span class="paren">(</span><ul class="args-list inline commas">
2184
2185 <li class="arg">
2186
2187 <code>type</code>
2188
2189 </li>
2190
2191 <li class="arg">
2192
2193 <code>listener</code>
2194
2195 </li>
2196
2197 <li class="arg">
2198
2199 <code class="optional">[useCapture]</code>
2200
2201 </li>
2202
2203 </ul><span class="paren">)</span>
2204 </div>
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221 <div class="meta">
2222
2223
2224 <p>Inherited from
2225 <a href="../classes/EventDispatcher.html#method_off">EventDispatcher</a>:
2226
2227
2228
2229 <a href="../files/createjs_events_EventDispatcher.js.html#l249"><code>off:249</code></a>
2230
2231 </p>
2232
2233
2234
2235
2236
2237 </div>
2238
2239 <div class="description">
2240 <p>A shortcut to the removeEventListener method, with the same parameters and return value. This is a companion to the
2241.on method.</p>
2242<p><b>IMPORTANT:</b> To remove a listener added with <code>on</code>, you must pass in the returned wrapper function as the listener. See
2243<a href="../classes/EventDispatcher.html#method_on" class="crosslink">on</a> for an example.</p>
2244
2245 </div>
2246
2247
2248 <div class="params">
2249 <h4>Parameters:</h4>
2250
2251 <ul class="params-list">
2252
2253 <li class="param">
2254
2255 <code class="param-name">type</code>
2256 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2257
2258
2259
2260
2261 <div class="param-description">
2262 <p>The string type of the event.</p>
2263
2264 </div>
2265
2266
2267 </li>
2268
2269 <li class="param">
2270
2271 <code class="param-name">listener</code>
2272 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
2273
2274
2275
2276
2277 <div class="param-description">
2278 <p>The listener function or object.</p>
2279
2280 </div>
2281
2282
2283 </li>
2284
2285 <li class="param">
2286
2287 <code class="param-name optional">[useCapture]</code>
2288 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2289 <span class="flag optional" title="This parameter is optional.">optional</span>
2290
2291
2292
2293
2294 <div class="param-description">
2295 <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
2296
2297 </div>
2298
2299
2300 </li>
2301
2302 </ul>
2303 </div>
2304
2305
2306
2307
2308
2309</div>
2310
2311
2312 <div id="method_on" class="method item inherited">
2313 <h3 class="name"><code>on</code></h3>
2314
2315
2316 <div class="args">
2317 <span class="paren">(</span><ul class="args-list inline commas">
2318
2319 <li class="arg">
2320
2321 <code>type</code>
2322
2323 </li>
2324
2325 <li class="arg">
2326
2327 <code>listener</code>
2328
2329 </li>
2330
2331 <li class="arg">
2332
2333 <code class="optional">[scope]</code>
2334
2335 </li>
2336
2337 <li class="arg">
2338
2339 <code class="optional">[once=false]</code>
2340
2341 </li>
2342
2343 <li class="arg">
2344
2345 <code class="optional">[data]</code>
2346
2347 </li>
2348
2349 <li class="arg">
2350
2351 <code class="optional">[useCapture=false]</code>
2352
2353 </li>
2354
2355 </ul><span class="paren">)</span>
2356 </div>
2357
2358
2359
2360 <span class="returns-inline">
2361 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a></span>
2362 </span>
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377 <div class="meta">
2378
2379
2380 <p>Inherited from
2381 <a href="../classes/EventDispatcher.html#method_on">EventDispatcher</a>:
2382
2383
2384
2385 <a href="../files/createjs_events_EventDispatcher.js.html#l173"><code>on:173</code></a>
2386
2387 </p>
2388
2389
2390
2391
2392
2393 </div>
2394
2395 <div class="description">
2396 <p><p>A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener
2397only run once, associate arbitrary data with the listener, and remove the listener.</p></p>
2398<p><p>This method works by creating an anonymous wrapper function and subscribing it with addEventListener.
2399The wrapper function is returned for use with <code>removeEventListener</code> (or <code>off</code>).</p></p>
2400<p><p><b>IMPORTANT:</b> To remove a listener added with <code>on</code>, you must pass in the returned wrapper function as the listener, or use
2401<a href="../classes/Event.html#method_remove" class="crosslink">remove</a>. Likewise, each time you call <code>on</code> a NEW wrapper function is subscribed, so multiple calls
2402to <code>on</code> with the same params will create multiple listeners.</p></p>
2403<h4>Example</h4>
2404
2405<pre class="code prettyprint"><code> var listener = myBtn.on("click", handleClick, null, false, {count:3});
2406 function handleClick(evt, data) {
2407 data.count -= 1;
2408 console.log(this == myBtn); // true - scope defaults to the dispatcher
2409 if (data.count == 0) {
2410 alert("clicked 3 times!");
2411 myBtn.off("click", listener);
2412 // alternately: evt.remove();
2413 }
2414 }</code></pre>
2415
2416 </div>
2417
2418
2419 <div class="params">
2420 <h4>Parameters:</h4>
2421
2422 <ul class="params-list">
2423
2424 <li class="param">
2425
2426 <code class="param-name">type</code>
2427 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2428
2429
2430
2431
2432 <div class="param-description">
2433 <p>The string type of the event.</p>
2434
2435 </div>
2436
2437
2438 </li>
2439
2440 <li class="param">
2441
2442 <code class="param-name">listener</code>
2443 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
2444
2445
2446
2447
2448 <div class="param-description">
2449 <p>An object with a handleEvent method, or a function that will be called when
2450the event is dispatched.</p>
2451
2452 </div>
2453
2454
2455 </li>
2456
2457 <li class="param">
2458
2459 <code class="param-name optional">[scope]</code>
2460 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
2461 <span class="flag optional" title="This parameter is optional.">optional</span>
2462
2463
2464
2465
2466 <div class="param-description">
2467 <p>The scope to execute the listener in. Defaults to the dispatcher/currentTarget for function listeners, and to the listener itself for object listeners (ie. using handleEvent).</p>
2468
2469 </div>
2470
2471
2472 </li>
2473
2474 <li class="param">
2475
2476 <code class="param-name optional">[once=false]</code>
2477 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2478 <span class="flag optional" title="This parameter is optional.">optional</span>
2479
2480
2481
2482
2483 <div class="param-description">
2484 <p>If true, the listener will remove itself after the first time it is triggered.</p>
2485
2486 </div>
2487
2488
2489 </li>
2490
2491 <li class="param">
2492
2493 <code class="param-name optional">[data]</code>
2494 <span class="type"></span>
2495 <span class="flag optional" title="This parameter is optional.">optional</span>
2496
2497
2498
2499
2500 <div class="param-description">
2501 <p>Arbitrary data that will be included as the second parameter when the listener is called.</p>
2502
2503 </div>
2504
2505
2506 </li>
2507
2508 <li class="param">
2509
2510 <code class="param-name optional">[useCapture=false]</code>
2511 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2512 <span class="flag optional" title="This parameter is optional.">optional</span>
2513
2514
2515
2516
2517 <div class="param-description">
2518 <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
2519
2520 </div>
2521
2522
2523 </li>
2524
2525 </ul>
2526 </div>
2527
2528
2529
2530 <div class="returns">
2531 <h4>Returns:</h4>
2532
2533 <div class="returns-description">
2534
2535
2536 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a></span>:
2537
2538 <p>Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener.</p>
2539
2540
2541 </div>
2542 </div>
2543
2544
2545
2546</div>
2547
2548
2549 <div id="method_removeAllEventListeners" class="method item inherited">
2550 <h3 class="name"><code>removeAllEventListeners</code></h3>
2551
2552
2553 <div class="args">
2554 <span class="paren">(</span><ul class="args-list inline commas">
2555
2556 <li class="arg">
2557
2558 <code class="optional">[type]</code>
2559
2560 </li>
2561
2562 </ul><span class="paren">)</span>
2563 </div>
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580 <div class="meta">
2581
2582
2583 <p>Inherited from
2584 <a href="../classes/EventDispatcher.html#method_removeAllEventListeners">EventDispatcher</a>:
2585
2586
2587
2588 <a href="../files/createjs_events_EventDispatcher.js.html#l263"><code>removeAllEventListeners:263</code></a>
2589
2590 </p>
2591
2592
2593
2594
2595
2596 </div>
2597
2598 <div class="description">
2599 <p><p>Removes all listeners for the specified type, or all listeners of all types.</p></p>
2600<h4>Example</h4>
2601
2602<pre class="code prettyprint"><code> // Remove all listeners
2603 displayObject.removeAllEventListeners();
2604
2605 // Remove all click listeners
2606 displayObject.removeAllEventListeners("click");</code></pre>
2607
2608 </div>
2609
2610
2611 <div class="params">
2612 <h4>Parameters:</h4>
2613
2614 <ul class="params-list">
2615
2616 <li class="param">
2617
2618 <code class="param-name optional">[type]</code>
2619 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2620 <span class="flag optional" title="This parameter is optional.">optional</span>
2621
2622
2623
2624
2625 <div class="param-description">
2626 <p>The string type of the event. If omitted, all listeners for all types will be removed.</p>
2627
2628 </div>
2629
2630
2631 </li>
2632
2633 </ul>
2634 </div>
2635
2636
2637
2638
2639
2640</div>
2641
2642
2643 <div id="method_removeEventListener" class="method item inherited">
2644 <h3 class="name"><code>removeEventListener</code></h3>
2645
2646
2647 <div class="args">
2648 <span class="paren">(</span><ul class="args-list inline commas">
2649
2650 <li class="arg">
2651
2652 <code>type</code>
2653
2654 </li>
2655
2656 <li class="arg">
2657
2658 <code>listener</code>
2659
2660 </li>
2661
2662 <li class="arg">
2663
2664 <code class="optional">[useCapture]</code>
2665
2666 </li>
2667
2668 </ul><span class="paren">)</span>
2669 </div>
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686 <div class="meta">
2687
2688
2689 <p>Inherited from
2690 <a href="../classes/EventDispatcher.html#method_removeEventListener">EventDispatcher</a>:
2691
2692
2693
2694 <a href="../files/createjs_events_EventDispatcher.js.html#l219"><code>removeEventListener:219</code></a>
2695
2696 </p>
2697
2698
2699
2700
2701
2702 </div>
2703
2704 <div class="description">
2705 <p><p>Removes the specified event listener.</p></p>
2706<p><p><b>Important Note:</b> that you must pass the exact function reference used when the event was added. If a proxy
2707function, or function closure is used as the callback, the proxy/closure reference must be used - a new proxy or
2708closure will not work.</p></p>
2709<h4>Example</h4>
2710
2711<pre class="code prettyprint"><code> displayObject.removeEventListener("click", handleClick);</code></pre>
2712
2713 </div>
2714
2715
2716 <div class="params">
2717 <h4>Parameters:</h4>
2718
2719 <ul class="params-list">
2720
2721 <li class="param">
2722
2723 <code class="param-name">type</code>
2724 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2725
2726
2727
2728
2729 <div class="param-description">
2730 <p>The string type of the event.</p>
2731
2732 </div>
2733
2734
2735 </li>
2736
2737 <li class="param">
2738
2739 <code class="param-name">listener</code>
2740 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
2741
2742
2743
2744
2745 <div class="param-description">
2746 <p>The listener function or object.</p>
2747
2748 </div>
2749
2750
2751 </li>
2752
2753 <li class="param">
2754
2755 <code class="param-name optional">[useCapture]</code>
2756 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2757 <span class="flag optional" title="This parameter is optional.">optional</span>
2758
2759
2760
2761
2762 <div class="param-description">
2763 <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
2764
2765 </div>
2766
2767
2768 </li>
2769
2770 </ul>
2771 </div>
2772
2773
2774
2775
2776
2777</div>
2778
2779
2780 <div id="method_toString" class="method item">
2781 <h3 class="name"><code>toString</code></h3>
2782
2783
2784 <span class="paren">()</span>
2785
2786
2787
2788 <span class="returns-inline">
2789 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2790 </span>
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805 <div class="meta">
2806
2807 <p>Inherited from
2808 <a href="../classes/EventDispatcher.html#method_toString">
2809 EventDispatcher
2810 </a>
2811
2812 but overwritten in
2813
2814
2815
2816 <a href="../files/easeljs_display_SpriteSheet.js.html#l456"><code>toString:456</code></a>
2817
2818 </p>
2819
2820
2821
2822
2823
2824 </div>
2825
2826 <div class="description">
2827 <p>Returns a string representation of this object.</p>
2828
2829 </div>
2830
2831
2832
2833
2834 <div class="returns">
2835 <h4>Returns:</h4>
2836
2837 <div class="returns-description">
2838
2839
2840 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
2841
2842 <p>a string representation of the instance.</p>
2843
2844
2845 </div>
2846 </div>
2847
2848
2849
2850</div>
2851
2852
2853 <div id="method_willTrigger" class="method item inherited">
2854 <h3 class="name"><code>willTrigger</code></h3>
2855
2856
2857 <div class="args">
2858 <span class="paren">(</span><ul class="args-list inline commas">
2859
2860 <li class="arg">
2861
2862 <code>type</code>
2863
2864 </li>
2865
2866 </ul><span class="paren">)</span>
2867 </div>
2868
2869
2870
2871 <span class="returns-inline">
2872 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2873 </span>
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888 <div class="meta">
2889
2890
2891 <p>Inherited from
2892 <a href="../classes/EventDispatcher.html#method_willTrigger">EventDispatcher</a>:
2893
2894
2895
2896 <a href="../files/createjs_events_EventDispatcher.js.html#l350"><code>willTrigger:350</code></a>
2897
2898 </p>
2899
2900
2901
2902
2903
2904 </div>
2905
2906 <div class="description">
2907 <p>Indicates whether there is at least one listener for the specified event type on this object or any of its
2908ancestors (parent, parent's parent, etc). A return value of true indicates that if a bubbling event of the
2909specified type is dispatched from this object, it will trigger at least one listener.</p>
2910<p>This is similar to <a href="../classes/EventDispatcher.html#method_hasEventListener" class="crosslink">hasEventListener</a>, but it searches the entire
2911event flow for a listener, not just this object.</p>
2912
2913 </div>
2914
2915
2916 <div class="params">
2917 <h4>Parameters:</h4>
2918
2919 <ul class="params-list">
2920
2921 <li class="param">
2922
2923 <code class="param-name">type</code>
2924 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2925
2926
2927
2928
2929 <div class="param-description">
2930 <p>The string type of the event.</p>
2931
2932 </div>
2933
2934
2935 </li>
2936
2937 </ul>
2938 </div>
2939
2940
2941
2942 <div class="returns">
2943 <h4>Returns:</h4>
2944
2945 <div class="returns-description">
2946
2947
2948 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>:
2949
2950 <p>Returns <code>true</code> if there is at least one listener for the specified event.</p>
2951
2952
2953 </div>
2954 </div>
2955
2956
2957
2958</div>
2959
2960
2961 </div>
2962
2963
2964
2965 <div id="properties" class="api-class-tabpanel">
2966 <h2 class="off-left">Properties</h2>
2967
2968
2969 <div id="property__animations" class="property item protected">
2970 <h3 class="name"><code>_animations</code></h3>
2971 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array" class="crosslink external" target="_blank">Array</a></span>
2972
2973
2974
2975
2976 <span class="flag protected">protected</span>
2977
2978
2979
2980
2981
2982
2983
2984
2985 <div class="meta">
2986
2987
2988
2989 <p>
2990
2991 Defined in
2992
2993
2994
2995
2996 <a href="../files/easeljs_display_SpriteSheet.js.html#l232"><code>_animations:232</code></a>
2997
2998 </p>
2999
3000
3001
3002
3003 </div>
3004
3005 <div class="description">
3006
3007 </div>
3008
3009
3010
3011
3012
3013
3014</div>
3015
3016
3017 <div id="property__captureListeners" class="property item protected inherited">
3018 <h3 class="name"><code>_captureListeners</code></h3>
3019 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
3020
3021
3022
3023
3024 <span class="flag protected">protected</span>
3025
3026
3027
3028
3029
3030
3031
3032
3033 <div class="meta">
3034
3035
3036 <p>Inherited from
3037 <a href="../classes/EventDispatcher.html#property__captureListeners">EventDispatcher</a>:
3038
3039
3040
3041 <a href="../files/createjs_events_EventDispatcher.js.html#l106"><code>_captureListeners:106</code></a>
3042
3043 </p>
3044
3045
3046
3047
3048 </div>
3049
3050 <div class="description">
3051
3052 </div>
3053
3054
3055
3056
3057
3058
3059</div>
3060
3061
3062 <div id="property__data" class="property item protected">
3063 <h3 class="name"><code>_data</code></h3>
3064 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
3065
3066
3067
3068
3069 <span class="flag protected">protected</span>
3070
3071
3072
3073
3074
3075
3076
3077
3078 <div class="meta">
3079
3080
3081
3082 <p>
3083
3084 Defined in
3085
3086
3087
3088
3089 <a href="../files/easeljs_display_SpriteSheet.js.html#l253"><code>_data:253</code></a>
3090
3091 </p>
3092
3093
3094
3095
3096 </div>
3097
3098 <div class="description">
3099
3100 </div>
3101
3102
3103
3104
3105
3106
3107</div>
3108
3109
3110 <div id="property__frameHeight" class="property item protected">
3111 <h3 class="name"><code>_frameHeight</code></h3>
3112 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3113
3114
3115
3116
3117 <span class="flag protected">protected</span>
3118
3119
3120
3121
3122
3123
3124
3125
3126 <div class="meta">
3127
3128
3129
3130 <p>
3131
3132 Defined in
3133
3134
3135
3136
3137 <a href="../files/easeljs_display_SpriteSheet.js.html#l268"><code>_frameHeight:268</code></a>
3138
3139 </p>
3140
3141
3142
3143
3144 </div>
3145
3146 <div class="description">
3147
3148 </div>
3149
3150
3151
3152
3153
3154
3155</div>
3156
3157
3158 <div id="property__frames" class="property item protected">
3159 <h3 class="name"><code>_frames</code></h3>
3160 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array" class="crosslink external" target="_blank">Array</a></span>
3161
3162
3163
3164
3165 <span class="flag protected">protected</span>
3166
3167
3168
3169
3170
3171
3172
3173
3174 <div class="meta">
3175
3176
3177
3178 <p>
3179
3180 Defined in
3181
3182
3183
3184
3185 <a href="../files/easeljs_display_SpriteSheet.js.html#l239"><code>_frames:239</code></a>
3186
3187 </p>
3188
3189
3190
3191
3192 </div>
3193
3194 <div class="description">
3195
3196 </div>
3197
3198
3199
3200
3201
3202
3203</div>
3204
3205
3206 <div id="property__frameWidth" class="property item protected">
3207 <h3 class="name"><code>_frameWidth</code></h3>
3208 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3209
3210
3211
3212
3213 <span class="flag protected">protected</span>
3214
3215
3216
3217
3218
3219
3220
3221
3222 <div class="meta">
3223
3224
3225
3226 <p>
3227
3228 Defined in
3229
3230
3231
3232
3233 <a href="../files/easeljs_display_SpriteSheet.js.html#l275"><code>_frameWidth:275</code></a>
3234
3235 </p>
3236
3237
3238
3239
3240 </div>
3241
3242 <div class="description">
3243
3244 </div>
3245
3246
3247
3248
3249
3250
3251</div>
3252
3253
3254 <div id="property__images" class="property item protected">
3255 <h3 class="name"><code>_images</code></h3>
3256 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array" class="crosslink external" target="_blank">Array</a></span>
3257
3258
3259
3260
3261 <span class="flag protected">protected</span>
3262
3263
3264
3265
3266
3267
3268
3269
3270 <div class="meta">
3271
3272
3273
3274 <p>
3275
3276 Defined in
3277
3278
3279
3280
3281 <a href="../files/easeljs_display_SpriteSheet.js.html#l246"><code>_images:246</code></a>
3282
3283 </p>
3284
3285
3286
3287
3288 </div>
3289
3290 <div class="description">
3291
3292 </div>
3293
3294
3295
3296
3297
3298
3299</div>
3300
3301
3302 <div id="property__listeners" class="property item protected inherited">
3303 <h3 class="name"><code>_listeners</code></h3>
3304 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
3305
3306
3307
3308
3309 <span class="flag protected">protected</span>
3310
3311
3312
3313
3314
3315
3316
3317
3318 <div class="meta">
3319
3320
3321 <p>Inherited from
3322 <a href="../classes/EventDispatcher.html#property__listeners">EventDispatcher</a>:
3323
3324
3325
3326 <a href="../files/createjs_events_EventDispatcher.js.html#l99"><code>_listeners:99</code></a>
3327
3328 </p>
3329
3330
3331
3332
3333 </div>
3334
3335 <div class="description">
3336
3337 </div>
3338
3339
3340
3341
3342
3343
3344</div>
3345
3346
3347 <div id="property__loadCount" class="property item protected">
3348 <h3 class="name"><code>_loadCount</code></h3>
3349 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3350
3351
3352
3353
3354 <span class="flag protected">protected</span>
3355
3356
3357
3358
3359
3360
3361
3362
3363 <div class="meta">
3364
3365
3366
3367 <p>
3368
3369 Defined in
3370
3371
3372
3373
3374 <a href="../files/easeljs_display_SpriteSheet.js.html#l260"><code>_loadCount:260</code></a>
3375
3376 </p>
3377
3378
3379
3380
3381 </div>
3382
3383 <div class="description">
3384
3385 </div>
3386
3387
3388
3389
3390
3391
3392</div>
3393
3394
3395 <div id="property__margin" class="property item protected">
3396 <h3 class="name"><code>_margin</code></h3>
3397 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3398
3399
3400
3401
3402 <span class="flag protected">protected</span>
3403
3404
3405
3406
3407
3408
3409
3410
3411 <div class="meta">
3412
3413
3414
3415 <p>
3416
3417 Defined in
3418
3419
3420
3421
3422 <a href="../files/easeljs_display_SpriteSheet.js.html#l310"><code>_margin:310</code></a>
3423
3424 </p>
3425
3426
3427
3428
3429 </div>
3430
3431 <div class="description">
3432
3433 </div>
3434
3435
3436
3437
3438
3439
3440</div>
3441
3442
3443 <div id="property__numFrames" class="property item protected">
3444 <h3 class="name"><code>_numFrames</code></h3>
3445 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3446
3447
3448
3449
3450 <span class="flag protected">protected</span>
3451
3452
3453
3454
3455
3456
3457
3458
3459 <div class="meta">
3460
3461
3462
3463 <p>
3464
3465 Defined in
3466
3467
3468
3469
3470 <a href="../files/easeljs_display_SpriteSheet.js.html#l282"><code>_numFrames:282</code></a>
3471
3472 </p>
3473
3474
3475
3476
3477 </div>
3478
3479 <div class="description">
3480
3481 </div>
3482
3483
3484
3485
3486
3487
3488</div>
3489
3490
3491 <div id="property__regX" class="property item protected">
3492 <h3 class="name"><code>_regX</code></h3>
3493 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3494
3495
3496
3497
3498 <span class="flag protected">protected</span>
3499
3500
3501
3502
3503
3504
3505
3506
3507 <div class="meta">
3508
3509
3510
3511 <p>
3512
3513 Defined in
3514
3515
3516
3517
3518 <a href="../files/easeljs_display_SpriteSheet.js.html#l289"><code>_regX:289</code></a>
3519
3520 </p>
3521
3522
3523
3524
3525 </div>
3526
3527 <div class="description">
3528
3529 </div>
3530
3531
3532
3533
3534
3535
3536</div>
3537
3538
3539 <div id="property__regY" class="property item protected">
3540 <h3 class="name"><code>_regY</code></h3>
3541 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3542
3543
3544
3545
3546 <span class="flag protected">protected</span>
3547
3548
3549
3550
3551
3552
3553
3554
3555 <div class="meta">
3556
3557
3558
3559 <p>
3560
3561 Defined in
3562
3563
3564
3565
3566 <a href="../files/easeljs_display_SpriteSheet.js.html#l296"><code>_regY:296</code></a>
3567
3568 </p>
3569
3570
3571
3572
3573 </div>
3574
3575 <div class="description">
3576
3577 </div>
3578
3579
3580
3581
3582
3583
3584</div>
3585
3586
3587 <div id="property__spacing" class="property item protected">
3588 <h3 class="name"><code>_spacing</code></h3>
3589 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3590
3591
3592
3593
3594 <span class="flag protected">protected</span>
3595
3596
3597
3598
3599
3600
3601
3602
3603 <div class="meta">
3604
3605
3606
3607 <p>
3608
3609 Defined in
3610
3611
3612
3613
3614 <a href="../files/easeljs_display_SpriteSheet.js.html#l303"><code>_spacing:303</code></a>
3615
3616 </p>
3617
3618
3619
3620
3621 </div>
3622
3623 <div class="description">
3624
3625 </div>
3626
3627
3628
3629
3630
3631
3632</div>
3633
3634
3635 <div id="property_animations" class="property item">
3636 <h3 class="name"><code>animations</code></h3>
3637 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array" class="crosslink external" target="_blank">Array</a></span>
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648 <span class="flag readonly">readonly</span>
3649
3650
3651 <div class="meta">
3652
3653
3654
3655 <p>
3656
3657 Defined in
3658
3659
3660
3661
3662 <a href="../files/easeljs_display_SpriteSheet.js.html#l375"><code>animations:375</code></a>
3663
3664 </p>
3665
3666
3667
3668
3669 </div>
3670
3671 <div class="description">
3672 <p>Returns an array of all available animation names available on this sprite sheet as strings.</p>
3673
3674 </div>
3675
3676
3677
3678
3679
3680
3681</div>
3682
3683
3684 <div id="property_complete" class="property item">
3685 <h3 class="name"><code>complete</code></h3>
3686 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697 <span class="flag readonly">readonly</span>
3698
3699
3700 <div class="meta">
3701
3702
3703
3704 <p>
3705
3706 Defined in
3707
3708
3709
3710
3711 <a href="../files/easeljs_display_SpriteSheet.js.html#l214"><code>complete:214</code></a>
3712
3713 </p>
3714
3715
3716
3717
3718 </div>
3719
3720 <div class="description">
3721 <p>Indicates whether all images are finished loading.</p>
3722
3723 </div>
3724
3725
3726
3727
3728
3729
3730</div>
3731
3732
3733 <div id="property_framerate" class="property item">
3734 <h3 class="name"><code>framerate</code></h3>
3735 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747 <div class="meta">
3748
3749
3750
3751 <p>
3752
3753 Defined in
3754
3755
3756
3757
3758 <a href="../files/easeljs_display_SpriteSheet.js.html#l222"><code>framerate:222</code></a>
3759
3760 </p>
3761
3762
3763
3764
3765 </div>
3766
3767 <div class="description">
3768 <p>Specifies the framerate to use by default for Sprite instances using the SpriteSheet. See the Sprite class
3769<a href="../classes/Sprite.html#property_framerate" class="crosslink">framerate</a> for more information.</p>
3770
3771 </div>
3772
3773
3774
3775
3776
3777
3778</div>
3779
3780
3781 </div>
3782
3783
3784
3785
3786
3787 <div id="events" class="api-class-tabpanel">
3788 <h2 class="off-left">Events</h2>
3789
3790
3791 <div id="event_complete" class="events item">
3792 <h3 class="name"><code>complete</code></h3>
3793 <span class="type"></span>
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803 <div class="meta">
3804
3805
3806
3807 <p>
3808
3809 Defined in
3810
3811
3812
3813
3814 <a href="../files/easeljs_display_SpriteSheet.js.html#l327"><code>complete:327</code></a>
3815
3816 </p>
3817
3818
3819
3820
3821 <p>Available since 0.6.0</p>
3822
3823 </div>
3824
3825 <div class="description">
3826 <p>Dispatched when all images are loaded. Note that this only fires if the images
3827were not fully loaded when the sprite sheet was initialized. You should check the complete property
3828to prior to adding a listener. Ex.</p>
3829<pre class="code prettyprint"><code>var sheet = new createjs.SpriteSheet(data);
3830if (!sheet.complete) {
3831 // not preloaded, listen for the complete event:
3832 sheet.addEventListener("complete", handler);
3833}</code></pre>
3834
3835 </div>
3836
3837
3838 <div class="params">
3839 <h4>Event Payload:</h4>
3840
3841 <ul class="params-list">
3842
3843 <li class="param">
3844
3845 <code class="param-name">target</code>
3846 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
3847
3848
3849
3850
3851 <div class="param-description">
3852 <p>The object that dispatched the event.</p>
3853
3854 </div>
3855
3856
3857 </li>
3858
3859 <li class="param">
3860
3861 <code class="param-name">type</code>
3862 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
3863
3864
3865
3866
3867 <div class="param-description">
3868 <p>The event type.</p>
3869
3870 </div>
3871
3872
3873 </li>
3874
3875 </ul>
3876 </div>
3877
3878
3879
3880
3881</div>
3882
3883
3884 <div id="event_error" class="events item">
3885 <h3 class="name"><code>error</code></h3>
3886 <span class="type"></span>
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896 <div class="meta">
3897
3898
3899
3900 <p>
3901
3902 Defined in
3903
3904
3905
3906
3907 <a href="../files/easeljs_display_SpriteSheet.js.html#l352"><code>error:352</code></a>
3908
3909 </p>
3910
3911
3912
3913
3914 <p>Available since 0.8.2</p>
3915
3916 </div>
3917
3918 <div class="description">
3919 <p>Dispatched when an image encounters an error. A SpriteSheet will dispatch an error event for each image that
3920encounters an error, and will still dispatch a <a href="../classes/SpriteSheet.html#event_complete" class="crosslink">complete</a>
3921event once all images are finished processing, even if an error is encountered.</p>
3922
3923 </div>
3924
3925
3926 <div class="params">
3927 <h4>Event Payload:</h4>
3928
3929 <ul class="params-list">
3930
3931 <li class="param">
3932
3933 <code class="param-name">src</code>
3934 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
3935
3936
3937
3938
3939 <div class="param-description">
3940 <p>The source of the image that failed to load.</p>
3941
3942 </div>
3943
3944
3945 </li>
3946
3947 </ul>
3948 </div>
3949
3950
3951
3952
3953</div>
3954
3955
3956 <div id="event_getframe" class="events item">
3957 <h3 class="name"><code>getframe</code></h3>
3958 <span class="type"></span>
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968 <div class="meta">
3969
3970
3971
3972 <p>
3973
3974 Defined in
3975
3976
3977
3978
3979 <a href="../files/easeljs_display_SpriteSheet.js.html#l344"><code>getframe:344</code></a>
3980
3981 </p>
3982
3983
3984
3985
3986 </div>
3987
3988 <div class="description">
3989 <p>Dispatched when getFrame is called with a valid frame index. This is primarily intended for use by <a href="../classes/SpriteSheetBuilder.html" class="crosslink">SpriteSheetBuilder</a>
3990when doing on-demand rendering.</p>
3991
3992 </div>
3993
3994
3995 <div class="params">
3996 <h4>Event Payload:</h4>
3997
3998 <ul class="params-list">
3999
4000 <li class="param">
4001
4002 <code class="param-name">index</code>
4003 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
4004
4005
4006
4007
4008 <div class="param-description">
4009 <p>The frame index.</p>
4010
4011 </div>
4012
4013
4014 </li>
4015
4016 <li class="param">
4017
4018 <code class="param-name">frame</code>
4019 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
4020
4021
4022
4023
4024 <div class="param-description">
4025 <p>The frame object that getFrame will return.</p>
4026
4027 </div>
4028
4029
4030 </li>
4031
4032 </ul>
4033 </div>
4034
4035
4036
4037
4038</div>
4039
4040
4041 </div>
4042
4043 </div>
4044</div>
4045
4046 </div>
4047 </div>
4048 </div>
4049 </div>
4050 </div>
4051</div>
4052<script src="../assets/vendor/prettify/prettify-min.js"></script>
4053<script>prettyPrint();</script>
4054<script src="../assets/js/yui-prettify.js"></script>
4055<script src="../assets/../api.js"></script>
4056<script src="../assets/js/api-filter.js"></script>
4057<script src="../assets/js/api-list.js"></script>
4058<script src="../assets/js/api-search.js"></script>
4059<script src="../assets/js/apidocs.js"></script>
4060</body>
4061</html>