libraries/EaselJS_docs/classes/Ticker.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 : Ticker</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>Ticker Class</h1>
199<div class="box meta">
200
201 <div class="uses">
202 Uses
203 <ul class="inline commas">
204
205 <li><a href="EventDispatcher.html">EventDispatcher</a></li>
206
207 </ul>
208 </div>
209
210
211
212
213
214 <div class="foundat">
215 Defined in: <a href="../files/createjs_utils_Ticker.js.html#l41"><code>Ticker:41</code></a>
216 </div>
217
218
219
220
221 Module: <a href="../modules/CreateJS.html">CreateJS</a>
222
223
224
225
226</div>
227
228
229
230<div class="box intro">
231 <p>The Ticker provides a centralized tick or heartbeat broadcast at a set interval. Listeners can subscribe to the tick
232event to be notified when a set time interval has elapsed.</p>
233<p>Note that the interval that the tick event is called is a target interval, and may be broadcast at a slower interval
234when under high CPU load. The Ticker class uses a static interface (ex. <code>Ticker.framerate = 30;</code>) and
235can not be instantiated.</p>
236<h4>Example</h4>
237
238<pre class="code prettyprint"><code> createjs.Ticker.addEventListener("tick", handleTick);
239 function handleTick(event) {
240 // Actions carried out each tick (aka frame)
241 if (!event.paused) {
242 // Actions carried out when the Ticker is not paused.
243 }
244 }</code></pre>
245
246</div>
247
248
249
250<div id="classdocs" class="tabview">
251 <ul class="api-class-tabs">
252 <li class="api-class-tab index"><a href="#index">Index</a></li>
253
254
255 <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
256
257
258 <li class="api-class-tab properties"><a href="#properties">Properties</a></li>
259
260
261
262 <li class="api-class-tab events"><a href="#events">Events</a></li>
263
264 </ul>
265
266 <div>
267 <div id="index" class="api-class-tabpanel index">
268 <h2 class="off-left">Item Index</h2>
269
270
271 <div class="index-section methods">
272 <h3>Methods</h3>
273
274 <ul class="index-list methods">
275
276 <li class="index-item method protected inherited">
277 <a href="#method__dispatchEvent">_dispatchEvent</a>
278
279
280
281 </li>
282
283 <li class="index-item method private">
284 <a href="#method__getFPS">_getFPS</a>
285
286
287 <span class="flag static">static</span>
288
289
290 </li>
291
292 <li class="index-item method private">
293 <a href="#method__getInterval">_getInterval</a>
294
295
296 <span class="flag static">static</span>
297
298
299 </li>
300
301 <li class="index-item method private">
302 <a href="#method__getTime">_getTime</a>
303
304
305 <span class="flag static">static</span>
306
307
308 </li>
309
310 <li class="index-item method private">
311 <a href="#method__handleRAF">_handleRAF</a>
312
313
314 <span class="flag static">static</span>
315
316
317 </li>
318
319 <li class="index-item method private">
320 <a href="#method__handleSynch">_handleSynch</a>
321
322
323 <span class="flag static">static</span>
324
325
326 </li>
327
328 <li class="index-item method private">
329 <a href="#method__handleTimeout">_handleTimeout</a>
330
331
332 <span class="flag static">static</span>
333
334
335 </li>
336
337 <li class="index-item method private">
338 <a href="#method__setFPS">_setFPS</a>
339
340
341 <span class="flag static">static</span>
342
343
344 </li>
345
346 <li class="index-item method private">
347 <a href="#method__setInterval">_setInterval</a>
348
349
350 <span class="flag static">static</span>
351
352
353 </li>
354
355 <li class="index-item method private">
356 <a href="#method__setupTick">_setupTick</a>
357
358
359 <span class="flag static">static</span>
360
361
362 </li>
363
364 <li class="index-item method private">
365 <a href="#method__tick">_tick</a>
366
367
368 <span class="flag static">static</span>
369
370
371 </li>
372
373 <li class="index-item method inherited">
374 <a href="#method_addEventListener">addEventListener</a>
375
376
377
378 </li>
379
380 <li class="index-item method inherited">
381 <a href="#method_dispatchEvent">dispatchEvent</a>
382
383
384
385 </li>
386
387 <li class="index-item method">
388 <a href="#method_getEventTime">getEventTime</a>
389
390
391 <span class="flag static">static</span>
392
393
394 </li>
395
396 <li class="index-item method">
397 <a href="#method_getMeasuredFPS">getMeasuredFPS</a>
398
399
400 <span class="flag static">static</span>
401
402
403 </li>
404
405 <li class="index-item method">
406 <a href="#method_getMeasuredTickTime">getMeasuredTickTime</a>
407
408
409 <span class="flag static">static</span>
410
411
412 </li>
413
414 <li class="index-item method">
415 <a href="#method_getTicks">getTicks</a>
416
417
418 <span class="flag static">static</span>
419
420
421 </li>
422
423 <li class="index-item method">
424 <a href="#method_getTime">getTime</a>
425
426
427 <span class="flag static">static</span>
428
429
430 </li>
431
432 <li class="index-item method inherited">
433 <a href="#method_hasEventListener">hasEventListener</a>
434
435
436
437 </li>
438
439 <li class="index-item method">
440 <a href="#method_init">init</a>
441
442
443 <span class="flag static">static</span>
444
445
446 </li>
447
448 <li class="index-item method inherited">
449 <a href="#method_off">off</a>
450
451
452
453 </li>
454
455 <li class="index-item method inherited">
456 <a href="#method_on">on</a>
457
458
459
460 </li>
461
462 <li class="index-item method inherited">
463 <a href="#method_removeAllEventListeners">removeAllEventListeners</a>
464
465
466
467 </li>
468
469 <li class="index-item method inherited">
470 <a href="#method_removeEventListener">removeEventListener</a>
471
472
473
474 </li>
475
476 <li class="index-item method">
477 <a href="#method_reset">reset</a>
478
479
480 <span class="flag static">static</span>
481
482
483 </li>
484
485 <li class="index-item method inherited">
486 <a href="#method_toString">toString</a>
487
488
489
490 </li>
491
492 <li class="index-item method inherited">
493 <a href="#method_willTrigger">willTrigger</a>
494
495
496
497 </li>
498
499 </ul>
500 </div>
501
502
503
504 <div class="index-section properties">
505 <h3>Properties</h3>
506
507 <ul class="index-list properties">
508
509 <li class="index-item property protected inherited">
510 <a href="#property__captureListeners">_captureListeners</a>
511
512
513
514 </li>
515
516 <li class="index-item property private">
517 <a href="#property__inited">_inited</a>
518
519
520 <span class="flag static">static</span>
521
522
523 </li>
524
525 <li class="index-item property private">
526 <a href="#property__interval">_interval</a>
527
528
529 <span class="flag static">static</span>
530
531
532 </li>
533
534 <li class="index-item property private">
535 <a href="#property__lastTime">_lastTime</a>
536
537
538 <span class="flag static">static</span>
539
540
541 </li>
542
543 <li class="index-item property protected inherited">
544 <a href="#property__listeners">_listeners</a>
545
546
547
548 </li>
549
550 <li class="index-item property private">
551 <a href="#property__pausedTicks">_pausedTicks</a>
552
553
554 <span class="flag static">static</span>
555
556
557 </li>
558
559 <li class="index-item property private">
560 <a href="#property__pausedTime">_pausedTime</a>
561
562
563 <span class="flag static">static</span>
564
565
566 </li>
567
568 <li class="index-item property private">
569 <a href="#property__raf">_raf</a>
570
571
572 <span class="flag static">static</span>
573
574
575 </li>
576
577 <li class="index-item property private">
578 <a href="#property__startTime">_startTime</a>
579
580
581 <span class="flag static">static</span>
582
583
584 </li>
585
586 <li class="index-item property private">
587 <a href="#property__ticks">_ticks</a>
588
589
590 <span class="flag static">static</span>
591
592
593 </li>
594
595 <li class="index-item property private">
596 <a href="#property__tickTimes">_tickTimes</a>
597
598
599 <span class="flag static">static</span>
600
601
602 </li>
603
604 <li class="index-item property private">
605 <a href="#property__timerId">_timerId</a>
606
607
608 <span class="flag static">static</span>
609
610
611 </li>
612
613 <li class="index-item property private">
614 <a href="#property__times">_times</a>
615
616
617 <span class="flag static">static</span>
618
619
620 </li>
621
622 <li class="index-item property">
623 <a href="#property_framerate">framerate</a>
624
625
626 <span class="flag static">static</span>
627
628
629 </li>
630
631 <li class="index-item property">
632 <a href="#property_interval">interval</a>
633
634
635 <span class="flag static">static</span>
636
637
638 </li>
639
640 <li class="index-item property">
641 <a href="#property_maxDelta">maxDelta</a>
642
643
644 <span class="flag static">static</span>
645
646
647 </li>
648
649 <li class="index-item property">
650 <a href="#property_paused">paused</a>
651
652
653 <span class="flag static">static</span>
654
655
656 </li>
657
658 <li class="index-item property">
659 <a href="#property_RAF">RAF</a>
660
661
662 <span class="flag static">static</span>
663
664
665 </li>
666
667 <li class="index-item property">
668 <a href="#property_RAF_SYNCHED">RAF_SYNCHED</a>
669
670
671 <span class="flag static">static</span>
672
673
674 </li>
675
676 <li class="index-item property">
677 <a href="#property_TIMEOUT">TIMEOUT</a>
678
679
680 <span class="flag static">static</span>
681
682
683 </li>
684
685 <li class="index-item property">
686 <a href="#property_timingMode">timingMode</a>
687
688
689 <span class="flag static">static</span>
690
691
692 </li>
693
694 </ul>
695 </div>
696
697
698
699
700
701 <div class="index-section events">
702 <h3>Events</h3>
703
704 <ul class="index-list events">
705
706 <li class="index-item event">
707 <a href="#event_tick">tick</a>
708
709
710
711 </li>
712
713 </ul>
714 </div>
715
716 </div>
717
718
719 <div id="methods" class="api-class-tabpanel">
720 <h2 class="off-left">Methods</h2>
721
722
723 <div id="method__dispatchEvent" class="method item protected inherited">
724 <h3 class="name"><code>_dispatchEvent</code></h3>
725
726
727 <div class="args">
728 <span class="paren">(</span><ul class="args-list inline commas">
729
730 <li class="arg">
731
732 <code>eventObj</code>
733
734 </li>
735
736 <li class="arg">
737
738 <code>eventPhase</code>
739
740 </li>
741
742 </ul><span class="paren">)</span>
743 </div>
744
745
746
747
748
749
750
751 <span class="flag protected">protected</span>
752
753
754
755
756
757
758
759
760
761
762 <div class="meta">
763
764
765 <p>Inherited from
766 <a href="../classes/EventDispatcher.html#method__dispatchEvent">EventDispatcher</a>:
767
768
769
770 <a href="../files/createjs_events_EventDispatcher.js.html#l380"><code>_dispatchEvent:380</code></a>
771
772 </p>
773
774
775
776
777
778 </div>
779
780 <div class="description">
781
782 </div>
783
784
785 <div class="params">
786 <h4>Parameters:</h4>
787
788 <ul class="params-list">
789
790 <li class="param">
791
792 <code class="param-name">eventObj</code>
793 <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>
794
795
796
797
798 <div class="param-description">
799
800 </div>
801
802
803 </li>
804
805 <li class="param">
806
807 <code class="param-name">eventPhase</code>
808 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
809
810
811
812
813 <div class="param-description">
814
815 </div>
816
817
818 </li>
819
820 </ul>
821 </div>
822
823
824
825
826
827</div>
828
829
830 <div id="method__getFPS" class="method item private">
831 <h3 class="name"><code>_getFPS</code></h3>
832
833
834 <span class="paren">()</span>
835
836
837
838 <span class="returns-inline">
839 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
840 </span>
841
842
843
844
845
846 <span class="flag private">private</span>
847
848
849
850
851
852 <span class="flag static">static</span>
853
854
855
856
857
858
859 <div class="meta">
860
861
862
863 <p>
864
865 Defined in
866
867
868
869
870 <a href="../files/createjs_utils_Ticker.js.html#l348"><code>_getFPS:348</code></a>
871
872 </p>
873
874
875
876
877
878 </div>
879
880 <div class="description">
881 <p>Use the <a href="../classes/Ticker.html#property_framerate" class="crosslink">framerate</a> property instead.</p>
882
883 </div>
884
885
886
887
888 <div class="returns">
889 <h4>Returns:</h4>
890
891 <div class="returns-description">
892
893
894 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>:
895
896
897 </div>
898 </div>
899
900
901
902</div>
903
904
905 <div id="method__getInterval" class="method item private">
906 <h3 class="name"><code>_getInterval</code></h3>
907
908
909 <span class="paren">()</span>
910
911
912
913 <span class="returns-inline">
914 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
915 </span>
916
917
918
919
920
921 <span class="flag private">private</span>
922
923
924
925
926
927 <span class="flag static">static</span>
928
929
930
931
932
933
934 <div class="meta">
935
936
937
938 <p>
939
940 Defined in
941
942
943
944
945 <a href="../files/createjs_utils_Ticker.js.html#l322"><code>_getInterval:322</code></a>
946
947 </p>
948
949
950
951
952
953 </div>
954
955 <div class="description">
956 <p>Use the <a href="../classes/Ticker.html#property_interval" class="crosslink">interval</a> property instead.</p>
957
958 </div>
959
960
961
962
963 <div class="returns">
964 <h4>Returns:</h4>
965
966 <div class="returns-description">
967
968
969 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>:
970
971
972 </div>
973 </div>
974
975
976
977</div>
978
979
980 <div id="method__getTime" class="method item private">
981 <h3 class="name"><code>_getTime</code></h3>
982
983
984 <span class="paren">()</span>
985
986
987
988
989
990
991
992 <span class="flag private">private</span>
993
994
995
996
997
998 <span class="flag static">static</span>
999
1000
1001
1002
1003
1004
1005 <div class="meta">
1006
1007
1008
1009 <p>
1010
1011 Defined in
1012
1013
1014
1015
1016 <a href="../files/createjs_utils_Ticker.js.html#l599"><code>_getTime:599</code></a>
1017
1018 </p>
1019
1020
1021
1022
1023
1024 </div>
1025
1026 <div class="description">
1027
1028 </div>
1029
1030
1031
1032
1033
1034
1035</div>
1036
1037
1038 <div id="method__handleRAF" class="method item private">
1039 <h3 class="name"><code>_handleRAF</code></h3>
1040
1041
1042 <span class="paren">()</span>
1043
1044
1045
1046
1047
1048
1049
1050 <span class="flag private">private</span>
1051
1052
1053
1054
1055
1056 <span class="flag static">static</span>
1057
1058
1059
1060
1061
1062
1063 <div class="meta">
1064
1065
1066
1067 <p>
1068
1069 Defined in
1070
1071
1072
1073
1074 <a href="../files/createjs_utils_Ticker.js.html#l522"><code>_handleRAF:522</code></a>
1075
1076 </p>
1077
1078
1079
1080
1081
1082 </div>
1083
1084 <div class="description">
1085
1086 </div>
1087
1088
1089
1090
1091
1092
1093</div>
1094
1095
1096 <div id="method__handleSynch" class="method item private">
1097 <h3 class="name"><code>_handleSynch</code></h3>
1098
1099
1100 <span class="paren">()</span>
1101
1102
1103
1104
1105
1106
1107
1108 <span class="flag private">private</span>
1109
1110
1111
1112
1113
1114 <span class="flag static">static</span>
1115
1116
1117
1118
1119
1120
1121 <div class="meta">
1122
1123
1124
1125 <p>
1126
1127 Defined in
1128
1129
1130
1131
1132 <a href="../files/createjs_utils_Ticker.js.html#l507"><code>_handleSynch:507</code></a>
1133
1134 </p>
1135
1136
1137
1138
1139
1140 </div>
1141
1142 <div class="description">
1143
1144 </div>
1145
1146
1147
1148
1149
1150
1151</div>
1152
1153
1154 <div id="method__handleTimeout" class="method item private">
1155 <h3 class="name"><code>_handleTimeout</code></h3>
1156
1157
1158 <span class="paren">()</span>
1159
1160
1161
1162
1163
1164
1165
1166 <span class="flag private">private</span>
1167
1168
1169
1170
1171
1172 <span class="flag static">static</span>
1173
1174
1175
1176
1177
1178
1179 <div class="meta">
1180
1181
1182
1183 <p>
1184
1185 Defined in
1186
1187
1188
1189
1190 <a href="../files/createjs_utils_Ticker.js.html#l533"><code>_handleTimeout:533</code></a>
1191
1192 </p>
1193
1194
1195
1196
1197
1198 </div>
1199
1200 <div class="description">
1201
1202 </div>
1203
1204
1205
1206
1207
1208
1209</div>
1210
1211
1212 <div id="method__setFPS" class="method item private">
1213 <h3 class="name"><code>_setFPS</code></h3>
1214
1215
1216 <div class="args">
1217 <span class="paren">(</span><ul class="args-list inline commas">
1218
1219 <li class="arg">
1220
1221 <code>value</code>
1222
1223 </li>
1224
1225 </ul><span class="paren">)</span>
1226 </div>
1227
1228
1229
1230
1231
1232
1233
1234 <span class="flag private">private</span>
1235
1236
1237
1238
1239
1240 <span class="flag static">static</span>
1241
1242
1243
1244
1245
1246
1247 <div class="meta">
1248
1249
1250
1251 <p>
1252
1253 Defined in
1254
1255
1256
1257
1258 <a href="../files/createjs_utils_Ticker.js.html#l335"><code>_setFPS:335</code></a>
1259
1260 </p>
1261
1262
1263
1264
1265
1266 </div>
1267
1268 <div class="description">
1269 <p>Use the <a href="../classes/Ticker.html#property_framerate" class="crosslink">framerate</a> property instead.</p>
1270
1271 </div>
1272
1273
1274 <div class="params">
1275 <h4>Parameters:</h4>
1276
1277 <ul class="params-list">
1278
1279 <li class="param">
1280
1281 <code class="param-name">value</code>
1282 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
1283
1284
1285
1286
1287 <div class="param-description">
1288
1289 </div>
1290
1291
1292 </li>
1293
1294 </ul>
1295 </div>
1296
1297
1298
1299
1300
1301</div>
1302
1303
1304 <div id="method__setInterval" class="method item private">
1305 <h3 class="name"><code>_setInterval</code></h3>
1306
1307
1308 <div class="args">
1309 <span class="paren">(</span><ul class="args-list inline commas">
1310
1311 <li class="arg">
1312
1313 <code>interval</code>
1314
1315 </li>
1316
1317 </ul><span class="paren">)</span>
1318 </div>
1319
1320
1321
1322
1323
1324
1325
1326 <span class="flag private">private</span>
1327
1328
1329
1330
1331
1332 <span class="flag static">static</span>
1333
1334
1335
1336
1337
1338
1339 <div class="meta">
1340
1341
1342
1343 <p>
1344
1345 Defined in
1346
1347
1348
1349
1350 <a href="../files/createjs_utils_Ticker.js.html#l307"><code>_setInterval:307</code></a>
1351
1352 </p>
1353
1354
1355
1356
1357
1358 </div>
1359
1360 <div class="description">
1361 <p>Use the <a href="../classes/Ticker.html#property_interval" class="crosslink">interval</a> property instead.</p>
1362
1363 </div>
1364
1365
1366 <div class="params">
1367 <h4>Parameters:</h4>
1368
1369 <ul class="params-list">
1370
1371 <li class="param">
1372
1373 <code class="param-name">interval</code>
1374 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
1375
1376
1377
1378
1379 <div class="param-description">
1380
1381 </div>
1382
1383
1384 </li>
1385
1386 </ul>
1387 </div>
1388
1389
1390
1391
1392
1393</div>
1394
1395
1396 <div id="method__setupTick" class="method item private">
1397 <h3 class="name"><code>_setupTick</code></h3>
1398
1399
1400 <span class="paren">()</span>
1401
1402
1403
1404
1405
1406
1407
1408 <span class="flag private">private</span>
1409
1410
1411
1412
1413
1414 <span class="flag static">static</span>
1415
1416
1417
1418
1419
1420
1421 <div class="meta">
1422
1423
1424
1425 <p>
1426
1427 Defined in
1428
1429
1430
1431
1432 <a href="../files/createjs_utils_Ticker.js.html#l544"><code>_setupTick:544</code></a>
1433
1434 </p>
1435
1436
1437
1438
1439
1440 </div>
1441
1442 <div class="description">
1443
1444 </div>
1445
1446
1447
1448
1449
1450
1451</div>
1452
1453
1454 <div id="method__tick" class="method item private">
1455 <h3 class="name"><code>_tick</code></h3>
1456
1457
1458 <span class="paren">()</span>
1459
1460
1461
1462
1463
1464
1465
1466 <span class="flag private">private</span>
1467
1468
1469
1470
1471
1472 <span class="flag static">static</span>
1473
1474
1475
1476
1477
1478
1479 <div class="meta">
1480
1481
1482
1483 <p>
1484
1485 Defined in
1486
1487
1488
1489
1490 <a href="../files/createjs_utils_Ticker.js.html#l565"><code>_tick:565</code></a>
1491
1492 </p>
1493
1494
1495
1496
1497
1498 </div>
1499
1500 <div class="description">
1501
1502 </div>
1503
1504
1505
1506
1507
1508
1509</div>
1510
1511
1512 <div id="method_addEventListener" class="method item inherited">
1513 <h3 class="name"><code>addEventListener</code></h3>
1514
1515
1516 <div class="args">
1517 <span class="paren">(</span><ul class="args-list inline commas">
1518
1519 <li class="arg">
1520
1521 <code>type</code>
1522
1523 </li>
1524
1525 <li class="arg">
1526
1527 <code>listener</code>
1528
1529 </li>
1530
1531 <li class="arg">
1532
1533 <code class="optional">[useCapture]</code>
1534
1535 </li>
1536
1537 </ul><span class="paren">)</span>
1538 </div>
1539
1540
1541
1542 <span class="returns-inline">
1543 <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>
1544 </span>
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559 <div class="meta">
1560
1561
1562 <p>Inherited from
1563 <a href="../classes/EventDispatcher.html#method_addEventListener">EventDispatcher</a>:
1564
1565
1566
1567 <a href="../files/createjs_events_EventDispatcher.js.html#l140"><code>addEventListener:140</code></a>
1568
1569 </p>
1570
1571
1572
1573
1574
1575 </div>
1576
1577 <div class="description">
1578 <p><p>Adds the specified event listener. Note that adding multiple listeners to the same function will result in
1579multiple callbacks getting fired.</p></p>
1580<h4>Example</h4>
1581
1582<pre class="code prettyprint"><code> displayObject.addEventListener("click", handleClick);
1583 function handleClick(event) {
1584 // Click happened.
1585 }</code></pre>
1586
1587 </div>
1588
1589
1590 <div class="params">
1591 <h4>Parameters:</h4>
1592
1593 <ul class="params-list">
1594
1595 <li class="param">
1596
1597 <code class="param-name">type</code>
1598 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
1599
1600
1601
1602
1603 <div class="param-description">
1604 <p>The string type of the event.</p>
1605
1606 </div>
1607
1608
1609 </li>
1610
1611 <li class="param">
1612
1613 <code class="param-name">listener</code>
1614 <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>
1615
1616
1617
1618
1619 <div class="param-description">
1620 <p>An object with a handleEvent method, or a function that will be called when
1621the event is dispatched.</p>
1622
1623 </div>
1624
1625
1626 </li>
1627
1628 <li class="param">
1629
1630 <code class="param-name optional">[useCapture]</code>
1631 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
1632 <span class="flag optional" title="This parameter is optional.">optional</span>
1633
1634
1635
1636
1637 <div class="param-description">
1638 <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
1639
1640 </div>
1641
1642
1643 </li>
1644
1645 </ul>
1646 </div>
1647
1648
1649
1650 <div class="returns">
1651 <h4>Returns:</h4>
1652
1653 <div class="returns-description">
1654
1655
1656 <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>:
1657
1658 <p>Returns the listener for chaining or assignment.</p>
1659
1660
1661 </div>
1662 </div>
1663
1664
1665
1666</div>
1667
1668
1669 <div id="method_dispatchEvent" class="method item inherited">
1670 <h3 class="name"><code>dispatchEvent</code></h3>
1671
1672
1673 <div class="args">
1674 <span class="paren">(</span><ul class="args-list inline commas">
1675
1676 <li class="arg">
1677
1678 <code>eventObj</code>
1679
1680 </li>
1681
1682 <li class="arg">
1683
1684 <code class="optional">[bubbles]</code>
1685
1686 </li>
1687
1688 <li class="arg">
1689
1690 <code class="optional">[cancelable]</code>
1691
1692 </li>
1693
1694 </ul><span class="paren">)</span>
1695 </div>
1696
1697
1698
1699 <span class="returns-inline">
1700 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
1701 </span>
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716 <div class="meta">
1717
1718
1719 <p>Inherited from
1720 <a href="../classes/EventDispatcher.html#method_dispatchEvent">EventDispatcher</a>:
1721
1722
1723
1724 <a href="../files/createjs_events_EventDispatcher.js.html#l285"><code>dispatchEvent:285</code></a>
1725
1726 </p>
1727
1728
1729
1730
1731
1732 </div>
1733
1734 <div class="description">
1735 <p><p>Dispatches the specified event to all listeners.</p></p>
1736<h4>Example</h4>
1737
1738<pre class="code prettyprint"><code> // Use a string event
1739 this.dispatchEvent("complete");
1740
1741 // Use an Event instance
1742 var event = new createjs.Event("progress");
1743 this.dispatchEvent(event);</code></pre>
1744
1745 </div>
1746
1747
1748 <div class="params">
1749 <h4>Parameters:</h4>
1750
1751 <ul class="params-list">
1752
1753 <li class="param">
1754
1755 <code class="param-name">eventObj</code>
1756 <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>
1757
1758
1759
1760
1761 <div class="param-description">
1762 <p>An object with a "type" property, or a string type.
1763While a generic object will work, it is recommended to use a CreateJS Event instance. If a string is used,
1764dispatchEvent will construct an Event instance if necessary with the specified type. This latter approach can
1765be used to avoid event object instantiation for non-bubbling events that may not have any listeners.</p>
1766
1767 </div>
1768
1769
1770 </li>
1771
1772 <li class="param">
1773
1774 <code class="param-name optional">[bubbles]</code>
1775 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
1776 <span class="flag optional" title="This parameter is optional.">optional</span>
1777
1778
1779
1780
1781 <div class="param-description">
1782 <p>Specifies the <code>bubbles</code> value when a string was passed to eventObj.</p>
1783
1784 </div>
1785
1786
1787 </li>
1788
1789 <li class="param">
1790
1791 <code class="param-name optional">[cancelable]</code>
1792 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
1793 <span class="flag optional" title="This parameter is optional.">optional</span>
1794
1795
1796
1797
1798 <div class="param-description">
1799 <p>Specifies the <code>cancelable</code> value when a string was passed to eventObj.</p>
1800
1801 </div>
1802
1803
1804 </li>
1805
1806 </ul>
1807 </div>
1808
1809
1810
1811 <div class="returns">
1812 <h4>Returns:</h4>
1813
1814 <div class="returns-description">
1815
1816
1817 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>:
1818
1819 <p>Returns false if <code>preventDefault()</code> was called on a cancelable event, true otherwise.</p>
1820
1821
1822 </div>
1823 </div>
1824
1825
1826
1827</div>
1828
1829
1830 <div id="method_getEventTime" class="method item">
1831 <h3 class="name"><code>getEventTime</code></h3>
1832
1833
1834 <div class="args">
1835 <span class="paren">(</span><ul class="args-list inline commas">
1836
1837 <li class="arg">
1838
1839 <code>runTime</code>
1840
1841 </li>
1842
1843 </ul><span class="paren">)</span>
1844 </div>
1845
1846
1847
1848 <span class="returns-inline">
1849 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
1850 </span>
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860 <span class="flag static">static</span>
1861
1862
1863
1864
1865
1866
1867 <div class="meta">
1868
1869
1870
1871 <p>
1872
1873 Defined in
1874
1875
1876
1877
1878 <a href="../files/createjs_utils_Ticker.js.html#l479"><code>getEventTime:479</code></a>
1879
1880 </p>
1881
1882
1883
1884
1885
1886 </div>
1887
1888 <div class="description">
1889 <p>Similar to the <a href="../classes/Ticker.html#method_getTime" class="crosslink">getTime</a> method, but returns the time on the most recent <a href="../classes/Ticker.html#event_tick" class="crosslink">tick</a>
1890event object.</p>
1891
1892 </div>
1893
1894
1895 <div class="params">
1896 <h4>Parameters:</h4>
1897
1898 <ul class="params-list">
1899
1900 <li class="param">
1901
1902 <code class="param-name">runTime</code>
1903 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
1904
1905
1906
1907
1908 <div class="param-description">
1909 <p>[runTime=false] If true, the runTime property will be returned instead of time.</p>
1910
1911 </div>
1912
1913
1914 </li>
1915
1916 </ul>
1917 </div>
1918
1919
1920
1921 <div class="returns">
1922 <h4>Returns:</h4>
1923
1924 <div class="returns-description">
1925
1926
1927 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>:
1928
1929 <p>The time or runTime property from the most recent tick event or -1.</p>
1930
1931
1932 </div>
1933 </div>
1934
1935
1936
1937</div>
1938
1939
1940 <div id="method_getMeasuredFPS" class="method item">
1941 <h3 class="name"><code>getMeasuredFPS</code></h3>
1942
1943
1944 <div class="args">
1945 <span class="paren">(</span><ul class="args-list inline commas">
1946
1947 <li class="arg">
1948
1949 <code class="optional">[ticks]</code>
1950
1951 </li>
1952
1953 </ul><span class="paren">)</span>
1954 </div>
1955
1956
1957
1958 <span class="returns-inline">
1959 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
1960 </span>
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970 <span class="flag static">static</span>
1971
1972
1973
1974
1975
1976
1977 <div class="meta">
1978
1979
1980
1981 <p>
1982
1983 Defined in
1984
1985
1986
1987
1988 <a href="../files/createjs_utils_Ticker.js.html#l447"><code>getMeasuredFPS:447</code></a>
1989
1990 </p>
1991
1992
1993
1994
1995
1996 </div>
1997
1998 <div class="description">
1999 <p>Returns the actual frames / ticks per second.</p>
2000
2001 </div>
2002
2003
2004 <div class="params">
2005 <h4>Parameters:</h4>
2006
2007 <ul class="params-list">
2008
2009 <li class="param">
2010
2011 <code class="param-name optional">[ticks]</code>
2012 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
2013 <span class="flag optional" title="This parameter is optional.">optional</span>
2014
2015
2016
2017
2018 <div class="param-description">
2019 <p>The number of previous ticks over which to measure the actual frames / ticks per second.
2020Defaults to the number of ticks per second.</p>
2021
2022 </div>
2023
2024
2025 </li>
2026
2027 </ul>
2028 </div>
2029
2030
2031
2032 <div class="returns">
2033 <h4>Returns:</h4>
2034
2035 <div class="returns-description">
2036
2037
2038 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>:
2039
2040 <p>The actual frames / ticks per second. Depending on performance, this may differ
2041from the target frames per second.</p>
2042
2043
2044 </div>
2045 </div>
2046
2047
2048
2049</div>
2050
2051
2052 <div id="method_getMeasuredTickTime" class="method item">
2053 <h3 class="name"><code>getMeasuredTickTime</code></h3>
2054
2055
2056 <div class="args">
2057 <span class="paren">(</span><ul class="args-list inline commas">
2058
2059 <li class="arg">
2060
2061 <code class="optional">[ticks]</code>
2062
2063 </li>
2064
2065 </ul><span class="paren">)</span>
2066 </div>
2067
2068
2069
2070 <span class="returns-inline">
2071 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
2072 </span>
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082 <span class="flag static">static</span>
2083
2084
2085
2086
2087
2088
2089 <div class="meta">
2090
2091
2092
2093 <p>
2094
2095 Defined in
2096
2097
2098
2099
2100 <a href="../files/createjs_utils_Ticker.js.html#l419"><code>getMeasuredTickTime:419</code></a>
2101
2102 </p>
2103
2104
2105
2106
2107
2108 </div>
2109
2110 <div class="description">
2111 <p>Returns the average time spent within a tick. This can vary significantly from the value provided by getMeasuredFPS
2112because it only measures the time spent within the tick execution stack. </p>
2113<p>Example 1: With a target FPS of 20, getMeasuredFPS() returns 20fps, which indicates an average of 50ms between
2114the end of one tick and the end of the next. However, getMeasuredTickTime() returns 15ms. This indicates that
2115there may be up to 35ms of "idle" time between the end of one tick and the start of the next.</p>
2116<p>Example 2: With a target FPS of 30, <a href="../classes/Ticker.html#property_framerate" class="crosslink">framerate</a> returns 10fps, which
2117indicates an average of 100ms between the end of one tick and the end of the next. However, <a href="../classes/Ticker.html#method_getMeasuredTickTime" class="crosslink">getMeasuredTickTime</a>
2118returns 20ms. This would indicate that something other than the tick is using ~80ms (another script, DOM
2119rendering, etc).</p>
2120
2121 </div>
2122
2123
2124 <div class="params">
2125 <h4>Parameters:</h4>
2126
2127 <ul class="params-list">
2128
2129 <li class="param">
2130
2131 <code class="param-name optional">[ticks]</code>
2132 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
2133 <span class="flag optional" title="This parameter is optional.">optional</span>
2134
2135
2136
2137
2138 <div class="param-description">
2139 <p>The number of previous ticks over which to measure the average time spent in a tick.
2140Defaults to the number of ticks per second. To get only the last tick's time, pass in 1.</p>
2141
2142 </div>
2143
2144
2145 </li>
2146
2147 </ul>
2148 </div>
2149
2150
2151
2152 <div class="returns">
2153 <h4>Returns:</h4>
2154
2155 <div class="returns-description">
2156
2157
2158 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>:
2159
2160 <p>The average time spent in a tick in milliseconds.</p>
2161
2162
2163 </div>
2164 </div>
2165
2166
2167
2168</div>
2169
2170
2171 <div id="method_getTicks" class="method item">
2172 <h3 class="name"><code>getTicks</code></h3>
2173
2174
2175 <div class="args">
2176 <span class="paren">(</span><ul class="args-list inline commas">
2177
2178 <li class="arg">
2179
2180 <code>pauseable</code>
2181
2182 </li>
2183
2184 </ul><span class="paren">)</span>
2185 </div>
2186
2187
2188
2189 <span class="returns-inline">
2190 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
2191 </span>
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201 <span class="flag static">static</span>
2202
2203
2204
2205
2206
2207
2208 <div class="meta">
2209
2210
2211
2212 <p>
2213
2214 Defined in
2215
2216
2217
2218
2219 <a href="../files/createjs_utils_Ticker.js.html#l491"><code>getTicks:491</code></a>
2220
2221 </p>
2222
2223
2224
2225
2226
2227 </div>
2228
2229 <div class="description">
2230 <p>Returns the number of ticks that have been broadcast by Ticker.</p>
2231
2232 </div>
2233
2234
2235 <div class="params">
2236 <h4>Parameters:</h4>
2237
2238 <ul class="params-list">
2239
2240 <li class="param">
2241
2242 <code class="param-name">pauseable</code>
2243 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2244
2245
2246
2247
2248 <div class="param-description">
2249 <p>Indicates whether to include ticks that would have been broadcast
2250while Ticker was paused. If true only tick events broadcast while Ticker is not paused will be returned.
2251If false, tick events that would have been broadcast while Ticker was paused will be included in the return
2252value. The default value is false.</p>
2253
2254 </div>
2255
2256
2257 </li>
2258
2259 </ul>
2260 </div>
2261
2262
2263
2264 <div class="returns">
2265 <h4>Returns:</h4>
2266
2267 <div class="returns-description">
2268
2269
2270 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>:
2271
2272 <p>of ticks that have been broadcast.</p>
2273
2274
2275 </div>
2276 </div>
2277
2278
2279
2280</div>
2281
2282
2283 <div id="method_getTime" class="method item">
2284 <h3 class="name"><code>getTime</code></h3>
2285
2286
2287 <div class="args">
2288 <span class="paren">(</span><ul class="args-list inline commas">
2289
2290 <li class="arg">
2291
2292 <code class="optional">[runTime=false]</code>
2293
2294 </li>
2295
2296 </ul><span class="paren">)</span>
2297 </div>
2298
2299
2300
2301 <span class="returns-inline">
2302 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
2303 </span>
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313 <span class="flag static">static</span>
2314
2315
2316
2317
2318
2319
2320 <div class="meta">
2321
2322
2323
2324 <p>
2325
2326 Defined in
2327
2328
2329
2330
2331 <a href="../files/createjs_utils_Ticker.js.html#l465"><code>getTime:465</code></a>
2332
2333 </p>
2334
2335
2336
2337
2338
2339 </div>
2340
2341 <div class="description">
2342 <p>Returns the number of milliseconds that have elapsed since Ticker was initialized via {{#crossLink "Ticker/init"}}.
2343Returns -1 if Ticker has not been initialized. For example, you could use
2344this in a time synchronized animation to determine the exact amount of time that has elapsed.</p>
2345
2346 </div>
2347
2348
2349 <div class="params">
2350 <h4>Parameters:</h4>
2351
2352 <ul class="params-list">
2353
2354 <li class="param">
2355
2356 <code class="param-name optional">[runTime=false]</code>
2357 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2358 <span class="flag optional" title="This parameter is optional.">optional</span>
2359
2360
2361
2362
2363 <div class="param-description">
2364 <p>If true only time elapsed while Ticker was not paused will be returned.
2365If false, the value returned will be total time elapsed since the first tick event listener was added.</p>
2366
2367 </div>
2368
2369
2370 </li>
2371
2372 </ul>
2373 </div>
2374
2375
2376
2377 <div class="returns">
2378 <h4>Returns:</h4>
2379
2380 <div class="returns-description">
2381
2382
2383 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>:
2384
2385 <p>Number of milliseconds that have elapsed since Ticker was initialized or -1.</p>
2386
2387
2388 </div>
2389 </div>
2390
2391
2392
2393</div>
2394
2395
2396 <div id="method_hasEventListener" class="method item inherited">
2397 <h3 class="name"><code>hasEventListener</code></h3>
2398
2399
2400 <div class="args">
2401 <span class="paren">(</span><ul class="args-list inline commas">
2402
2403 <li class="arg">
2404
2405 <code>type</code>
2406
2407 </li>
2408
2409 </ul><span class="paren">)</span>
2410 </div>
2411
2412
2413
2414 <span class="returns-inline">
2415 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2416 </span>
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431 <div class="meta">
2432
2433
2434 <p>Inherited from
2435 <a href="../classes/EventDispatcher.html#method_hasEventListener">EventDispatcher</a>:
2436
2437
2438
2439 <a href="../files/createjs_events_EventDispatcher.js.html#l339"><code>hasEventListener:339</code></a>
2440
2441 </p>
2442
2443
2444
2445
2446
2447 </div>
2448
2449 <div class="description">
2450 <p>Indicates whether there is at least one listener for the specified event type.</p>
2451
2452 </div>
2453
2454
2455 <div class="params">
2456 <h4>Parameters:</h4>
2457
2458 <ul class="params-list">
2459
2460 <li class="param">
2461
2462 <code class="param-name">type</code>
2463 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2464
2465
2466
2467
2468 <div class="param-description">
2469 <p>The string type of the event.</p>
2470
2471 </div>
2472
2473
2474 </li>
2475
2476 </ul>
2477 </div>
2478
2479
2480
2481 <div class="returns">
2482 <h4>Returns:</h4>
2483
2484 <div class="returns-description">
2485
2486
2487 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>:
2488
2489 <p>Returns true if there is at least one listener for the specified event.</p>
2490
2491
2492 </div>
2493 </div>
2494
2495
2496
2497</div>
2498
2499
2500 <div id="method_init" class="method item">
2501 <h3 class="name"><code>init</code></h3>
2502
2503
2504 <span class="paren">()</span>
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516 <span class="flag static">static</span>
2517
2518
2519
2520
2521
2522
2523 <div class="meta">
2524
2525
2526
2527 <p>
2528
2529 Defined in
2530
2531
2532
2533
2534 <a href="../files/createjs_utils_Ticker.js.html#l386"><code>init:386</code></a>
2535
2536 </p>
2537
2538
2539
2540
2541
2542 </div>
2543
2544 <div class="description">
2545 <p>Starts the tick. This is called automatically when the first listener is added.</p>
2546
2547 </div>
2548
2549
2550
2551
2552
2553
2554</div>
2555
2556
2557 <div id="method_off" class="method item inherited">
2558 <h3 class="name"><code>off</code></h3>
2559
2560
2561 <div class="args">
2562 <span class="paren">(</span><ul class="args-list inline commas">
2563
2564 <li class="arg">
2565
2566 <code>type</code>
2567
2568 </li>
2569
2570 <li class="arg">
2571
2572 <code>listener</code>
2573
2574 </li>
2575
2576 <li class="arg">
2577
2578 <code class="optional">[useCapture]</code>
2579
2580 </li>
2581
2582 </ul><span class="paren">)</span>
2583 </div>
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600 <div class="meta">
2601
2602
2603 <p>Inherited from
2604 <a href="../classes/EventDispatcher.html#method_off">EventDispatcher</a>:
2605
2606
2607
2608 <a href="../files/createjs_events_EventDispatcher.js.html#l249"><code>off:249</code></a>
2609
2610 </p>
2611
2612
2613
2614
2615
2616 </div>
2617
2618 <div class="description">
2619 <p>A shortcut to the removeEventListener method, with the same parameters and return value. This is a companion to the
2620.on method.</p>
2621<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
2622<a href="../classes/EventDispatcher.html#method_on" class="crosslink">on</a> for an example.</p>
2623
2624 </div>
2625
2626
2627 <div class="params">
2628 <h4>Parameters:</h4>
2629
2630 <ul class="params-list">
2631
2632 <li class="param">
2633
2634 <code class="param-name">type</code>
2635 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2636
2637
2638
2639
2640 <div class="param-description">
2641 <p>The string type of the event.</p>
2642
2643 </div>
2644
2645
2646 </li>
2647
2648 <li class="param">
2649
2650 <code class="param-name">listener</code>
2651 <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>
2652
2653
2654
2655
2656 <div class="param-description">
2657 <p>The listener function or object.</p>
2658
2659 </div>
2660
2661
2662 </li>
2663
2664 <li class="param">
2665
2666 <code class="param-name optional">[useCapture]</code>
2667 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2668 <span class="flag optional" title="This parameter is optional.">optional</span>
2669
2670
2671
2672
2673 <div class="param-description">
2674 <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
2675
2676 </div>
2677
2678
2679 </li>
2680
2681 </ul>
2682 </div>
2683
2684
2685
2686
2687
2688</div>
2689
2690
2691 <div id="method_on" class="method item inherited">
2692 <h3 class="name"><code>on</code></h3>
2693
2694
2695 <div class="args">
2696 <span class="paren">(</span><ul class="args-list inline commas">
2697
2698 <li class="arg">
2699
2700 <code>type</code>
2701
2702 </li>
2703
2704 <li class="arg">
2705
2706 <code>listener</code>
2707
2708 </li>
2709
2710 <li class="arg">
2711
2712 <code class="optional">[scope]</code>
2713
2714 </li>
2715
2716 <li class="arg">
2717
2718 <code class="optional">[once=false]</code>
2719
2720 </li>
2721
2722 <li class="arg">
2723
2724 <code class="optional">[data]</code>
2725
2726 </li>
2727
2728 <li class="arg">
2729
2730 <code class="optional">[useCapture=false]</code>
2731
2732 </li>
2733
2734 </ul><span class="paren">)</span>
2735 </div>
2736
2737
2738
2739 <span class="returns-inline">
2740 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a></span>
2741 </span>
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756 <div class="meta">
2757
2758
2759 <p>Inherited from
2760 <a href="../classes/EventDispatcher.html#method_on">EventDispatcher</a>:
2761
2762
2763
2764 <a href="../files/createjs_events_EventDispatcher.js.html#l173"><code>on:173</code></a>
2765
2766 </p>
2767
2768
2769
2770
2771
2772 </div>
2773
2774 <div class="description">
2775 <p><p>A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener
2776only run once, associate arbitrary data with the listener, and remove the listener.</p></p>
2777<p><p>This method works by creating an anonymous wrapper function and subscribing it with addEventListener.
2778The wrapper function is returned for use with <code>removeEventListener</code> (or <code>off</code>).</p></p>
2779<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
2780<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
2781to <code>on</code> with the same params will create multiple listeners.</p></p>
2782<h4>Example</h4>
2783
2784<pre class="code prettyprint"><code> var listener = myBtn.on("click", handleClick, null, false, {count:3});
2785 function handleClick(evt, data) {
2786 data.count -= 1;
2787 console.log(this == myBtn); // true - scope defaults to the dispatcher
2788 if (data.count == 0) {
2789 alert("clicked 3 times!");
2790 myBtn.off("click", listener);
2791 // alternately: evt.remove();
2792 }
2793 }</code></pre>
2794
2795 </div>
2796
2797
2798 <div class="params">
2799 <h4>Parameters:</h4>
2800
2801 <ul class="params-list">
2802
2803 <li class="param">
2804
2805 <code class="param-name">type</code>
2806 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2807
2808
2809
2810
2811 <div class="param-description">
2812 <p>The string type of the event.</p>
2813
2814 </div>
2815
2816
2817 </li>
2818
2819 <li class="param">
2820
2821 <code class="param-name">listener</code>
2822 <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>
2823
2824
2825
2826
2827 <div class="param-description">
2828 <p>An object with a handleEvent method, or a function that will be called when
2829the event is dispatched.</p>
2830
2831 </div>
2832
2833
2834 </li>
2835
2836 <li class="param">
2837
2838 <code class="param-name optional">[scope]</code>
2839 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
2840 <span class="flag optional" title="This parameter is optional.">optional</span>
2841
2842
2843
2844
2845 <div class="param-description">
2846 <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>
2847
2848 </div>
2849
2850
2851 </li>
2852
2853 <li class="param">
2854
2855 <code class="param-name optional">[once=false]</code>
2856 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2857 <span class="flag optional" title="This parameter is optional.">optional</span>
2858
2859
2860
2861
2862 <div class="param-description">
2863 <p>If true, the listener will remove itself after the first time it is triggered.</p>
2864
2865 </div>
2866
2867
2868 </li>
2869
2870 <li class="param">
2871
2872 <code class="param-name optional">[data]</code>
2873 <span class="type"></span>
2874 <span class="flag optional" title="This parameter is optional.">optional</span>
2875
2876
2877
2878
2879 <div class="param-description">
2880 <p>Arbitrary data that will be included as the second parameter when the listener is called.</p>
2881
2882 </div>
2883
2884
2885 </li>
2886
2887 <li class="param">
2888
2889 <code class="param-name optional">[useCapture=false]</code>
2890 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
2891 <span class="flag optional" title="This parameter is optional.">optional</span>
2892
2893
2894
2895
2896 <div class="param-description">
2897 <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
2898
2899 </div>
2900
2901
2902 </li>
2903
2904 </ul>
2905 </div>
2906
2907
2908
2909 <div class="returns">
2910 <h4>Returns:</h4>
2911
2912 <div class="returns-description">
2913
2914
2915 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a></span>:
2916
2917 <p>Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener.</p>
2918
2919
2920 </div>
2921 </div>
2922
2923
2924
2925</div>
2926
2927
2928 <div id="method_removeAllEventListeners" class="method item inherited">
2929 <h3 class="name"><code>removeAllEventListeners</code></h3>
2930
2931
2932 <div class="args">
2933 <span class="paren">(</span><ul class="args-list inline commas">
2934
2935 <li class="arg">
2936
2937 <code class="optional">[type]</code>
2938
2939 </li>
2940
2941 </ul><span class="paren">)</span>
2942 </div>
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959 <div class="meta">
2960
2961
2962 <p>Inherited from
2963 <a href="../classes/EventDispatcher.html#method_removeAllEventListeners">EventDispatcher</a>:
2964
2965
2966
2967 <a href="../files/createjs_events_EventDispatcher.js.html#l263"><code>removeAllEventListeners:263</code></a>
2968
2969 </p>
2970
2971
2972
2973
2974
2975 </div>
2976
2977 <div class="description">
2978 <p><p>Removes all listeners for the specified type, or all listeners of all types.</p></p>
2979<h4>Example</h4>
2980
2981<pre class="code prettyprint"><code> // Remove all listeners
2982 displayObject.removeAllEventListeners();
2983
2984 // Remove all click listeners
2985 displayObject.removeAllEventListeners("click");</code></pre>
2986
2987 </div>
2988
2989
2990 <div class="params">
2991 <h4>Parameters:</h4>
2992
2993 <ul class="params-list">
2994
2995 <li class="param">
2996
2997 <code class="param-name optional">[type]</code>
2998 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
2999 <span class="flag optional" title="This parameter is optional.">optional</span>
3000
3001
3002
3003
3004 <div class="param-description">
3005 <p>The string type of the event. If omitted, all listeners for all types will be removed.</p>
3006
3007 </div>
3008
3009
3010 </li>
3011
3012 </ul>
3013 </div>
3014
3015
3016
3017
3018
3019</div>
3020
3021
3022 <div id="method_removeEventListener" class="method item inherited">
3023 <h3 class="name"><code>removeEventListener</code></h3>
3024
3025
3026 <div class="args">
3027 <span class="paren">(</span><ul class="args-list inline commas">
3028
3029 <li class="arg">
3030
3031 <code>type</code>
3032
3033 </li>
3034
3035 <li class="arg">
3036
3037 <code>listener</code>
3038
3039 </li>
3040
3041 <li class="arg">
3042
3043 <code class="optional">[useCapture]</code>
3044
3045 </li>
3046
3047 </ul><span class="paren">)</span>
3048 </div>
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065 <div class="meta">
3066
3067
3068 <p>Inherited from
3069 <a href="../classes/EventDispatcher.html#method_removeEventListener">EventDispatcher</a>:
3070
3071
3072
3073 <a href="../files/createjs_events_EventDispatcher.js.html#l219"><code>removeEventListener:219</code></a>
3074
3075 </p>
3076
3077
3078
3079
3080
3081 </div>
3082
3083 <div class="description">
3084 <p><p>Removes the specified event listener.</p></p>
3085<p><p><b>Important Note:</b> that you must pass the exact function reference used when the event was added. If a proxy
3086function, or function closure is used as the callback, the proxy/closure reference must be used - a new proxy or
3087closure will not work.</p></p>
3088<h4>Example</h4>
3089
3090<pre class="code prettyprint"><code> displayObject.removeEventListener("click", handleClick);</code></pre>
3091
3092 </div>
3093
3094
3095 <div class="params">
3096 <h4>Parameters:</h4>
3097
3098 <ul class="params-list">
3099
3100 <li class="param">
3101
3102 <code class="param-name">type</code>
3103 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
3104
3105
3106
3107
3108 <div class="param-description">
3109 <p>The string type of the event.</p>
3110
3111 </div>
3112
3113
3114 </li>
3115
3116 <li class="param">
3117
3118 <code class="param-name">listener</code>
3119 <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>
3120
3121
3122
3123
3124 <div class="param-description">
3125 <p>The listener function or object.</p>
3126
3127 </div>
3128
3129
3130 </li>
3131
3132 <li class="param">
3133
3134 <code class="param-name optional">[useCapture]</code>
3135 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
3136 <span class="flag optional" title="This parameter is optional.">optional</span>
3137
3138
3139
3140
3141 <div class="param-description">
3142 <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
3143
3144 </div>
3145
3146
3147 </li>
3148
3149 </ul>
3150 </div>
3151
3152
3153
3154
3155
3156</div>
3157
3158
3159 <div id="method_reset" class="method item">
3160 <h3 class="name"><code>reset</code></h3>
3161
3162
3163 <span class="paren">()</span>
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175 <span class="flag static">static</span>
3176
3177
3178
3179
3180
3181
3182 <div class="meta">
3183
3184
3185
3186 <p>
3187
3188 Defined in
3189
3190
3191
3192
3193 <a href="../files/createjs_utils_Ticker.js.html#l401"><code>reset:401</code></a>
3194
3195 </p>
3196
3197
3198
3199
3200
3201 </div>
3202
3203 <div class="description">
3204 <p>Stops the Ticker and removes all listeners. Use init() to restart the Ticker.</p>
3205
3206 </div>
3207
3208
3209
3210
3211
3212
3213</div>
3214
3215
3216 <div id="method_toString" class="method item inherited">
3217 <h3 class="name"><code>toString</code></h3>
3218
3219
3220 <span class="paren">()</span>
3221
3222
3223
3224 <span class="returns-inline">
3225 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
3226 </span>
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241 <div class="meta">
3242
3243
3244 <p>Inherited from
3245 <a href="../classes/EventDispatcher.html#method_toString">EventDispatcher</a>:
3246
3247
3248
3249 <a href="../files/createjs_events_EventDispatcher.js.html#l370"><code>toString:370</code></a>
3250
3251 </p>
3252
3253
3254
3255
3256
3257 </div>
3258
3259 <div class="description">
3260
3261 </div>
3262
3263
3264
3265
3266 <div class="returns">
3267 <h4>Returns:</h4>
3268
3269 <div class="returns-description">
3270
3271
3272 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
3273
3274 <p>a string representation of the instance.</p>
3275
3276
3277 </div>
3278 </div>
3279
3280
3281
3282</div>
3283
3284
3285 <div id="method_willTrigger" class="method item inherited">
3286 <h3 class="name"><code>willTrigger</code></h3>
3287
3288
3289 <div class="args">
3290 <span class="paren">(</span><ul class="args-list inline commas">
3291
3292 <li class="arg">
3293
3294 <code>type</code>
3295
3296 </li>
3297
3298 </ul><span class="paren">)</span>
3299 </div>
3300
3301
3302
3303 <span class="returns-inline">
3304 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
3305 </span>
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320 <div class="meta">
3321
3322
3323 <p>Inherited from
3324 <a href="../classes/EventDispatcher.html#method_willTrigger">EventDispatcher</a>:
3325
3326
3327
3328 <a href="../files/createjs_events_EventDispatcher.js.html#l350"><code>willTrigger:350</code></a>
3329
3330 </p>
3331
3332
3333
3334
3335
3336 </div>
3337
3338 <div class="description">
3339 <p>Indicates whether there is at least one listener for the specified event type on this object or any of its
3340ancestors (parent, parent's parent, etc). A return value of true indicates that if a bubbling event of the
3341specified type is dispatched from this object, it will trigger at least one listener.</p>
3342<p>This is similar to <a href="../classes/EventDispatcher.html#method_hasEventListener" class="crosslink">hasEventListener</a>, but it searches the entire
3343event flow for a listener, not just this object.</p>
3344
3345 </div>
3346
3347
3348 <div class="params">
3349 <h4>Parameters:</h4>
3350
3351 <ul class="params-list">
3352
3353 <li class="param">
3354
3355 <code class="param-name">type</code>
3356 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
3357
3358
3359
3360
3361 <div class="param-description">
3362 <p>The string type of the event.</p>
3363
3364 </div>
3365
3366
3367 </li>
3368
3369 </ul>
3370 </div>
3371
3372
3373
3374 <div class="returns">
3375 <h4>Returns:</h4>
3376
3377 <div class="returns-description">
3378
3379
3380 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>:
3381
3382 <p>Returns <code>true</code> if there is at least one listener for the specified event.</p>
3383
3384
3385 </div>
3386 </div>
3387
3388
3389
3390</div>
3391
3392
3393 </div>
3394
3395
3396
3397 <div id="properties" class="api-class-tabpanel">
3398 <h2 class="off-left">Properties</h2>
3399
3400
3401 <div id="property__captureListeners" class="property item protected inherited">
3402 <h3 class="name"><code>_captureListeners</code></h3>
3403 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
3404
3405
3406
3407
3408 <span class="flag protected">protected</span>
3409
3410
3411
3412
3413
3414
3415
3416
3417 <div class="meta">
3418
3419
3420 <p>Inherited from
3421 <a href="../classes/EventDispatcher.html#property__captureListeners">EventDispatcher</a>:
3422
3423
3424
3425 <a href="../files/createjs_events_EventDispatcher.js.html#l106"><code>_captureListeners:106</code></a>
3426
3427 </p>
3428
3429
3430
3431
3432 </div>
3433
3434 <div class="description">
3435
3436 </div>
3437
3438
3439
3440
3441
3442
3443</div>
3444
3445
3446 <div id="property__inited" class="property item private">
3447 <h3 class="name"><code>_inited</code></h3>
3448 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
3449
3450
3451
3452
3453 <span class="flag private">private</span>
3454
3455
3456
3457
3458
3459 <span class="flag static">static</span>
3460
3461
3462
3463
3464 <div class="meta">
3465
3466
3467
3468 <p>
3469
3470 Defined in
3471
3472
3473
3474
3475 <a href="../files/createjs_utils_Ticker.js.html#l212"><code>_inited:212</code></a>
3476
3477 </p>
3478
3479
3480
3481
3482 </div>
3483
3484 <div class="description">
3485
3486 </div>
3487
3488
3489
3490
3491
3492
3493</div>
3494
3495
3496 <div id="property__interval" class="property item private">
3497 <h3 class="name"><code>_interval</code></h3>
3498 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3499
3500
3501
3502
3503 <span class="flag private">private</span>
3504
3505
3506
3507
3508
3509 <span class="flag static">static</span>
3510
3511
3512
3513
3514 <div class="meta">
3515
3516
3517
3518 <p>
3519
3520 Defined in
3521
3522
3523
3524
3525 <a href="../files/createjs_utils_Ticker.js.html#l254"><code>_interval:254</code></a>
3526
3527 </p>
3528
3529
3530
3531
3532 </div>
3533
3534 <div class="description">
3535
3536 </div>
3537
3538
3539
3540
3541
3542
3543</div>
3544
3545
3546 <div id="property__lastTime" class="property item private">
3547 <h3 class="name"><code>_lastTime</code></h3>
3548 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3549
3550
3551
3552
3553 <span class="flag private">private</span>
3554
3555
3556
3557
3558
3559 <span class="flag static">static</span>
3560
3561
3562
3563
3564 <div class="meta">
3565
3566
3567
3568 <p>
3569
3570 Defined in
3571
3572
3573
3574
3575 <a href="../files/createjs_utils_Ticker.js.html#l262"><code>_lastTime:262</code></a>
3576
3577 </p>
3578
3579
3580
3581
3582 </div>
3583
3584 <div class="description">
3585
3586 </div>
3587
3588
3589
3590
3591
3592
3593</div>
3594
3595
3596 <div id="property__listeners" class="property item protected inherited">
3597 <h3 class="name"><code>_listeners</code></h3>
3598 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
3599
3600
3601
3602
3603 <span class="flag protected">protected</span>
3604
3605
3606
3607
3608
3609
3610
3611
3612 <div class="meta">
3613
3614
3615 <p>Inherited from
3616 <a href="../classes/EventDispatcher.html#property__listeners">EventDispatcher</a>:
3617
3618
3619
3620 <a href="../files/createjs_events_EventDispatcher.js.html#l99"><code>_listeners:99</code></a>
3621
3622 </p>
3623
3624
3625
3626
3627 </div>
3628
3629 <div class="description">
3630
3631 </div>
3632
3633
3634
3635
3636
3637
3638</div>
3639
3640
3641 <div id="property__pausedTicks" class="property item private">
3642 <h3 class="name"><code>_pausedTicks</code></h3>
3643 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3644
3645
3646
3647
3648 <span class="flag private">private</span>
3649
3650
3651
3652
3653
3654 <span class="flag static">static</span>
3655
3656
3657
3658
3659 <div class="meta">
3660
3661
3662
3663 <p>
3664
3665 Defined in
3666
3667
3668
3669
3670 <a href="../files/createjs_utils_Ticker.js.html#l245"><code>_pausedTicks:245</code></a>
3671
3672 </p>
3673
3674
3675
3676
3677 </div>
3678
3679 <div class="description">
3680 <p>The number of ticks that have passed while Ticker has been paused</p>
3681
3682 </div>
3683
3684
3685
3686
3687
3688
3689</div>
3690
3691
3692 <div id="property__pausedTime" class="property item private">
3693 <h3 class="name"><code>_pausedTime</code></h3>
3694 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3695
3696
3697
3698
3699 <span class="flag private">private</span>
3700
3701
3702
3703
3704
3705 <span class="flag static">static</span>
3706
3707
3708
3709
3710 <div class="meta">
3711
3712
3713
3714 <p>
3715
3716 Defined in
3717
3718
3719
3720
3721 <a href="../files/createjs_utils_Ticker.js.html#l228"><code>_pausedTime:228</code></a>
3722
3723 </p>
3724
3725
3726
3727
3728 </div>
3729
3730 <div class="description">
3731
3732 </div>
3733
3734
3735
3736
3737
3738
3739</div>
3740
3741
3742 <div id="property__raf" class="property item private">
3743 <h3 class="name"><code>_raf</code></h3>
3744 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
3745
3746
3747
3748
3749 <span class="flag private">private</span>
3750
3751
3752
3753
3754
3755 <span class="flag static">static</span>
3756
3757
3758
3759
3760 <div class="meta">
3761
3762
3763
3764 <p>
3765
3766 Defined in
3767
3768
3769
3770
3771 <a href="../files/createjs_utils_Ticker.js.html#l295"><code>_raf:295</code></a>
3772
3773 </p>
3774
3775
3776
3777
3778 </div>
3779
3780 <div class="description">
3781 <p>True if currently using requestAnimationFrame, false if using setTimeout. This may be different than timingMode
3782if that property changed and a tick hasn't fired.</p>
3783
3784 </div>
3785
3786
3787
3788
3789
3790
3791</div>
3792
3793
3794 <div id="property__startTime" class="property item private">
3795 <h3 class="name"><code>_startTime</code></h3>
3796 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3797
3798
3799
3800
3801 <span class="flag private">private</span>
3802
3803
3804
3805
3806
3807 <span class="flag static">static</span>
3808
3809
3810
3811
3812 <div class="meta">
3813
3814
3815
3816 <p>
3817
3818 Defined in
3819
3820
3821
3822
3823 <a href="../files/createjs_utils_Ticker.js.html#l220"><code>_startTime:220</code></a>
3824
3825 </p>
3826
3827
3828
3829
3830 </div>
3831
3832 <div class="description">
3833
3834 </div>
3835
3836
3837
3838
3839
3840
3841</div>
3842
3843
3844 <div id="property__ticks" class="property item private">
3845 <h3 class="name"><code>_ticks</code></h3>
3846 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3847
3848
3849
3850
3851 <span class="flag private">private</span>
3852
3853
3854
3855
3856
3857 <span class="flag static">static</span>
3858
3859
3860
3861
3862 <div class="meta">
3863
3864
3865
3866 <p>
3867
3868 Defined in
3869
3870
3871
3872
3873 <a href="../files/createjs_utils_Ticker.js.html#l236"><code>_ticks:236</code></a>
3874
3875 </p>
3876
3877
3878
3879
3880 </div>
3881
3882 <div class="description">
3883 <p>The number of ticks that have passed</p>
3884
3885 </div>
3886
3887
3888
3889
3890
3891
3892</div>
3893
3894
3895 <div id="property__tickTimes" class="property item private">
3896 <h3 class="name"><code>_tickTimes</code></h3>
3897 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array" class="crosslink external" target="_blank">Array</a></span>
3898
3899
3900
3901
3902 <span class="flag private">private</span>
3903
3904
3905
3906
3907
3908 <span class="flag static">static</span>
3909
3910
3911
3912
3913 <div class="meta">
3914
3915
3916
3917 <p>
3918
3919 Defined in
3920
3921
3922
3923
3924 <a href="../files/createjs_utils_Ticker.js.html#l278"><code>_tickTimes:278</code></a>
3925
3926 </p>
3927
3928
3929
3930
3931 </div>
3932
3933 <div class="description">
3934
3935 </div>
3936
3937
3938
3939
3940
3941
3942</div>
3943
3944
3945 <div id="property__timerId" class="property item private">
3946 <h3 class="name"><code>_timerId</code></h3>
3947 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
3948
3949
3950
3951
3952 <span class="flag private">private</span>
3953
3954
3955
3956
3957
3958 <span class="flag static">static</span>
3959
3960
3961
3962
3963 <div class="meta">
3964
3965
3966
3967 <p>
3968
3969 Defined in
3970
3971
3972
3973
3974 <a href="../files/createjs_utils_Ticker.js.html#l286"><code>_timerId:286</code></a>
3975
3976 </p>
3977
3978
3979
3980
3981 </div>
3982
3983 <div class="description">
3984 <p>Stores the timeout or requestAnimationFrame id.</p>
3985
3986 </div>
3987
3988
3989
3990
3991
3992
3993</div>
3994
3995
3996 <div id="property__times" class="property item private">
3997 <h3 class="name"><code>_times</code></h3>
3998 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array" class="crosslink external" target="_blank">Array</a></span>
3999
4000
4001
4002
4003 <span class="flag private">private</span>
4004
4005
4006
4007
4008
4009 <span class="flag static">static</span>
4010
4011
4012
4013
4014 <div class="meta">
4015
4016
4017
4018 <p>
4019
4020 Defined in
4021
4022
4023
4024
4025 <a href="../files/createjs_utils_Ticker.js.html#l270"><code>_times:270</code></a>
4026
4027 </p>
4028
4029
4030
4031
4032 </div>
4033
4034 <div class="description">
4035
4036 </div>
4037
4038
4039
4040
4041
4042
4043</div>
4044
4045
4046 <div id="property_framerate" class="property item">
4047 <h3 class="name"><code>framerate</code></h3>
4048 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
4049
4050
4051
4052
4053
4054
4055
4056
4057 <span class="flag static">static</span>
4058
4059
4060
4061
4062 <div class="meta">
4063
4064
4065
4066 <p>
4067
4068 Defined in
4069
4070
4071
4072
4073 <a href="../files/createjs_utils_Ticker.js.html#l370"><code>framerate:370</code></a>
4074
4075 </p>
4076
4077
4078
4079
4080 </div>
4081
4082 <div class="description">
4083 <p>Indicates the target frame rate in frames per second (FPS). Effectively just a shortcut to <code>interval</code>, where
4084<code>framerate == 1000/interval</code>.</p>
4085
4086 </div>
4087
4088
4089
4090
4091
4092
4093</div>
4094
4095
4096 <div id="property_interval" class="property item">
4097 <h3 class="name"><code>interval</code></h3>
4098 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
4099
4100
4101
4102
4103
4104
4105
4106
4107 <span class="flag static">static</span>
4108
4109
4110
4111
4112 <div class="meta">
4113
4114
4115
4116 <p>
4117
4118 Defined in
4119
4120
4121
4122
4123 <a href="../files/createjs_utils_Ticker.js.html#l361"><code>interval:361</code></a>
4124
4125 </p>
4126
4127
4128
4129
4130 </div>
4131
4132 <div class="description">
4133 <p>Indicates the target time (in milliseconds) between ticks. Default is 50 (20 FPS).
4134Note that actual time between ticks may be more than specified depending on CPU load.
4135This property is ignored if the ticker is using the <code>RAF</code> timing mode.</p>
4136
4137 </div>
4138
4139
4140
4141
4142
4143
4144</div>
4145
4146
4147 <div id="property_maxDelta" class="property item">
4148 <h3 class="name"><code>maxDelta</code></h3>
4149 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
4150
4151
4152
4153
4154
4155
4156
4157
4158 <span class="flag static">static</span>
4159
4160
4161
4162
4163 <div class="meta">
4164
4165
4166
4167 <p>
4168
4169 Defined in
4170
4171
4172
4173
4174 <a href="../files/createjs_utils_Ticker.js.html#l155"><code>maxDelta:155</code></a>
4175
4176 </p>
4177
4178
4179
4180
4181 </div>
4182
4183 <div class="description">
4184 <p>Specifies a maximum value for the delta property in the tick event object. This is useful when building time
4185based animations and systems to prevent issues caused by large time gaps caused by background tabs, system sleep,
4186alert dialogs, or other blocking routines. Double the expected frame duration is often an effective value
4187(ex. maxDelta=50 when running at 40fps).</p>
4188<p>This does not impact any other values (ex. time, runTime, etc), so you may experience issues if you enable maxDelta
4189when using both delta and other values.</p>
4190<p>If 0, there is no maximum.</p>
4191
4192 </div>
4193
4194
4195 <p><strong>Default:</strong> 0</p>
4196
4197
4198
4199
4200
4201</div>
4202
4203
4204 <div id="property_paused" class="property item">
4205 <h3 class="name"><code>paused</code></h3>
4206 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
4207
4208
4209
4210
4211
4212
4213
4214
4215 <span class="flag static">static</span>
4216
4217
4218
4219
4220 <div class="meta">
4221
4222
4223
4224 <p>
4225
4226 Defined in
4227
4228
4229
4230
4231 <a href="../files/createjs_utils_Ticker.js.html#l172"><code>paused:172</code></a>
4232
4233 </p>
4234
4235
4236
4237
4238 </div>
4239
4240 <div class="description">
4241 <p>When the ticker is paused, all listeners will still receive a tick event, but the <code>paused</code> property
4242of the event will be <code>true</code>. Also, while paused the <code>runTime</code> will not increase. See <a href="../classes/Ticker.html#event_tick" class="crosslink">tick</a>,
4243<a href="../classes/Ticker.html#method_getTime" class="crosslink">getTime</a>, and <a href="../classes/Ticker.html#method_getEventTime" class="crosslink">getEventTime</a> for more
4244info.</p>
4245<h4>Example</h4>
4246
4247<pre class="code prettyprint"><code> createjs.Ticker.addEventListener("tick", handleTick);
4248 createjs.Ticker.paused = true;
4249 function handleTick(event) {
4250 console.log(event.paused,
4251 createjs.Ticker.getTime(false),
4252 createjs.Ticker.getTime(true));
4253 }</code></pre>
4254
4255 </div>
4256
4257
4258 <p><strong>Default:</strong> false</p>
4259
4260
4261
4262
4263
4264</div>
4265
4266
4267 <div id="property_RAF" class="property item">
4268 <h3 class="name"><code>RAF</code></h3>
4269 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
4270
4271
4272
4273
4274
4275
4276
4277
4278 <span class="flag static">static</span>
4279
4280
4281
4282 <span class="flag readonly">readonly</span>
4283
4284
4285 <div class="meta">
4286
4287
4288
4289 <p>
4290
4291 Defined in
4292
4293
4294
4295
4296 <a href="../files/createjs_utils_Ticker.js.html#l91"><code>RAF:91</code></a>
4297
4298 </p>
4299
4300
4301
4302
4303 </div>
4304
4305 <div class="description">
4306 <p>In this mode, Ticker passes through the requestAnimationFrame heartbeat, ignoring the target framerate completely.
4307Because requestAnimationFrame frequency is not deterministic, any content using this mode should be time based.
4308You can leverage <a href="../classes/Ticker.html#method_getTime" class="crosslink">getTime</a> and the <a href="../classes/Ticker.html#event_tick" class="crosslink">tick</a>
4309event object's "delta" properties to make this easier.</p>
4310<p>Falls back on <a href="../classes/Ticker.html#property_TIMEOUT" class="crosslink">TIMEOUT</a> if the requestAnimationFrame API is not
4311supported.</p>
4312
4313 </div>
4314
4315
4316 <p><strong>Default:</strong> "raf"</p>
4317
4318
4319
4320
4321
4322</div>
4323
4324
4325 <div id="property_RAF_SYNCHED" class="property item">
4326 <h3 class="name"><code>RAF_SYNCHED</code></h3>
4327 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
4328
4329
4330
4331
4332
4333
4334
4335
4336 <span class="flag static">static</span>
4337
4338
4339
4340 <span class="flag readonly">readonly</span>
4341
4342
4343 <div class="meta">
4344
4345
4346
4347 <p>
4348
4349 Defined in
4350
4351
4352
4353
4354 <a href="../files/createjs_utils_Ticker.js.html#l69"><code>RAF_SYNCHED:69</code></a>
4355
4356 </p>
4357
4358
4359
4360
4361 </div>
4362
4363 <div class="description">
4364 <p>In this mode, Ticker uses the requestAnimationFrame API, but attempts to synch the ticks to target framerate. It
4365uses a simple heuristic that compares the time of the RAF return to the target time for the current frame and
4366dispatches the tick when the time is within a certain threshold.</p>
4367<p>This mode has a higher variance for time between frames than <a href="../classes/Ticker.html#property_TIMEOUT" class="crosslink">TIMEOUT</a>,
4368but does not require that content be time based as with <a href="../classes/Ticker.html#property_RAF" class="crosslink">RAF</a> while
4369gaining the benefits of that API (screen synch, background throttling).</p>
4370<p>Variance is usually lowest for framerates that are a divisor of the RAF frequency. This is usually 60, so
4371framerates of 10, 12, 15, 20, and 30 work well.</p>
4372<p>Falls back to <a href="../classes/Ticker.html#property_TIMEOUT" class="crosslink">TIMEOUT</a> if the requestAnimationFrame API is not
4373supported.</p>
4374
4375 </div>
4376
4377
4378 <p><strong>Default:</strong> "synched"</p>
4379
4380
4381
4382
4383
4384</div>
4385
4386
4387 <div id="property_TIMEOUT" class="property item">
4388 <h3 class="name"><code>TIMEOUT</code></h3>
4389 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
4390
4391
4392
4393
4394
4395
4396
4397
4398 <span class="flag static">static</span>
4399
4400
4401
4402 <span class="flag readonly">readonly</span>
4403
4404
4405 <div class="meta">
4406
4407
4408
4409 <p>
4410
4411 Defined in
4412
4413
4414
4415
4416 <a href="../files/createjs_utils_Ticker.js.html#l107"><code>TIMEOUT:107</code></a>
4417
4418 </p>
4419
4420
4421
4422
4423 </div>
4424
4425 <div class="description">
4426 <p>In this mode, Ticker uses the setTimeout API. This provides predictable, adaptive frame timing, but does not
4427provide the benefits of requestAnimationFrame (screen synch, background throttling).</p>
4428
4429 </div>
4430
4431
4432 <p><strong>Default:</strong> "timeout"</p>
4433
4434
4435
4436
4437
4438</div>
4439
4440
4441 <div id="property_timingMode" class="property item">
4442 <h3 class="name"><code>timingMode</code></h3>
4443 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
4444
4445
4446
4447
4448
4449
4450
4451
4452 <span class="flag static">static</span>
4453
4454
4455
4456
4457 <div class="meta">
4458
4459
4460
4461 <p>
4462
4463 Defined in
4464
4465
4466
4467
4468 <a href="../files/createjs_utils_Ticker.js.html#l144"><code>timingMode:144</code></a>
4469
4470 </p>
4471
4472
4473
4474
4475 </div>
4476
4477 <div class="description">
4478 <p>Specifies the timing api (setTimeout or requestAnimationFrame) and mode to use. See
4479<a href="../classes/Ticker.html#property_TIMEOUT" class="crosslink">TIMEOUT</a>, <a href="../classes/Ticker.html#property_RAF" class="crosslink">RAF</a>, and
4480<a href="../classes/Ticker.html#property_RAF_SYNCHED" class="crosslink">RAF_SYNCHED</a> for mode details.</p>
4481
4482 </div>
4483
4484
4485 <p><strong>Default:</strong> Ticker.TIMEOUT</p>
4486
4487
4488
4489
4490
4491</div>
4492
4493
4494 </div>
4495
4496
4497
4498
4499
4500 <div id="events" class="api-class-tabpanel">
4501 <h2 class="off-left">Events</h2>
4502
4503
4504 <div id="event_tick" class="events item">
4505 <h3 class="name"><code>tick</code></h3>
4506 <span class="type"></span>
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516 <div class="meta">
4517
4518
4519
4520 <p>
4521
4522 Defined in
4523
4524
4525
4526
4527 <a href="../files/createjs_utils_Ticker.js.html#l120"><code>tick:120</code></a>
4528
4529 </p>
4530
4531
4532
4533
4534 <p>Available since 0.6.0</p>
4535
4536 </div>
4537
4538 <div class="description">
4539 <p>Dispatched each tick. The event will be dispatched to each listener even when the Ticker has been paused using
4540<a href="../classes/Ticker.html#property_paused" class="crosslink">paused</a>.</p>
4541<h4>Example</h4>
4542
4543<pre class="code prettyprint"><code> createjs.Ticker.addEventListener("tick", handleTick);
4544 function handleTick(event) {
4545 console.log("Paused:", event.paused, event.delta);
4546 }</code></pre>
4547
4548 </div>
4549
4550
4551 <div class="params">
4552 <h4>Event Payload:</h4>
4553
4554 <ul class="params-list">
4555
4556 <li class="param">
4557
4558 <code class="param-name">target</code>
4559 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
4560
4561
4562
4563
4564 <div class="param-description">
4565 <p>The object that dispatched the event.</p>
4566
4567 </div>
4568
4569
4570 </li>
4571
4572 <li class="param">
4573
4574 <code class="param-name">type</code>
4575 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
4576
4577
4578
4579
4580 <div class="param-description">
4581 <p>The event type.</p>
4582
4583 </div>
4584
4585
4586 </li>
4587
4588 <li class="param">
4589
4590 <code class="param-name">paused</code>
4591 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
4592
4593
4594
4595
4596 <div class="param-description">
4597 <p>Indicates whether the ticker is currently paused.</p>
4598
4599 </div>
4600
4601
4602 </li>
4603
4604 <li class="param">
4605
4606 <code class="param-name">delta</code>
4607 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
4608
4609
4610
4611
4612 <div class="param-description">
4613 <p>The time elapsed in ms since the last tick.</p>
4614
4615 </div>
4616
4617
4618 </li>
4619
4620 <li class="param">
4621
4622 <code class="param-name">time</code>
4623 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
4624
4625
4626
4627
4628 <div class="param-description">
4629 <p>The total time in ms since Ticker was initialized.</p>
4630
4631 </div>
4632
4633
4634 </li>
4635
4636 <li class="param">
4637
4638 <code class="param-name">runTime</code>
4639 <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
4640
4641
4642
4643
4644 <div class="param-description">
4645 <p>The total time in ms that Ticker was not paused since it was initialized. For example,
4646 you could determine the amount of time that the Ticker has been paused since initialization with <code>time-runTime</code>.</p>
4647
4648 </div>
4649
4650
4651 </li>
4652
4653 </ul>
4654 </div>
4655
4656
4657
4658
4659</div>
4660
4661
4662 </div>
4663
4664 </div>
4665</div>
4666
4667 </div>
4668 </div>
4669 </div>
4670 </div>
4671 </div>
4672</div>
4673<script src="../assets/vendor/prettify/prettify-min.js"></script>
4674<script>prettyPrint();</script>
4675<script src="../assets/js/yui-prettify.js"></script>
4676<script src="../assets/../api.js"></script>
4677<script src="../assets/js/api-filter.js"></script>
4678<script src="../assets/js/api-list.js"></script>
4679<script src="../assets/js/api-search.js"></script>
4680<script src="../assets/js/apidocs.js"></script>
4681</body>
4682</html>