{"id":9048,"date":"2015-05-03T02:20:02","date_gmt":"2015-05-03T02:20:02","guid":{"rendered":"http:\/\/2slick.com\/web\/?p=9048"},"modified":"2015-05-03T02:41:58","modified_gmt":"2015-05-03T02:41:58","slug":"timers-in-starling-using-the-delaycall-method","status":"publish","type":"post","link":"https:\/\/2slick.com\/web\/timers-in-starling-using-the-delaycall-method\/affordablewebsitestips\/tutorials","title":{"rendered":"Timers in Starling using the &#8216;delayCall&#8217; method"},"content":{"rendered":"<p>In Starling, you can delay a function from being called using the 'delayCall' method.<\/p>\n<p>Here is a method that traces the word 'hello':<\/p>\n<p><strong>public function delayedHello() : void<\/strong><\/p>\n<p><strong>{<\/strong><\/p>\n<p><strong>trace(\"hello!\");<\/strong><\/p>\n<p><strong>}<\/strong><\/p>\n<p>Here is how you call the function once after 3 seconds:<\/p>\n<p><strong>Starling.juggler.delayCall( delayedFunction, 3);<\/strong><\/p>\n<p>You can also call a function repeatedly every 3 seconds, as long as the juggler is active, using the delayedCall method.<\/p>\n<p><strong>var delayedCall:DelayedCall = new DelayedCall(delayedHello, 3);<\/strong><\/p>\n<p><strong> delayedCall.repeatCount = 0;<\/strong><\/p>\n<p><strong> Starling.juggler.add(delayedCall);<\/strong><\/p>\n<p>For more information:<\/p>\n<p><a title=\"starling wiki\" href=\"http:\/\/wiki.starling-framework.org\/manual\/animation \" target=\"_blank\">http:\/\/wiki.starling-framework.org\/manual\/animation&nbsp;<\/a><\/p>\n<p><a title=\"starling framework\" href=\"http:\/\/doc.starling-framework.org\/core\/starling\/animation\/Juggler.html\" target=\"_blank\">http:\/\/doc.starling-framework.org\/core\/starling\/animation\/Juggler.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Starling, you can delay a function from being called using the &#8216;delayCall&#8217; method. Here is a method that traces the word &#8216;hello&#8217;: public function delayedHello() : void { trace(&#8220;hello!&#8221;); } Here is how you call the function once after 3 seconds: Starling.juggler.delayCall( delayedFunction, 3); You can also call a function repeatedly every 3 seconds, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8958,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[752],"class_list":["post-9048","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-starling"],"_links":{"self":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/9048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/comments?post=9048"}],"version-history":[{"count":6,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/9048\/revisions"}],"predecessor-version":[{"id":9050,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/9048\/revisions\/9050"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/media\/8958"}],"wp:attachment":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/media?parent=9048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/categories?post=9048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/tags?post=9048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}