Call: (209) 560-6611

Timers in Starling using the ‘delayCall’ method

Date: May 3, 2015 Author: ang Category: Tutorials Tags: Comments: 0

In Starling, you can delay a function from being called using the 'delayCall' method.

Here is a method that traces the word 'hello':

public function delayedHello() : void

{

trace("hello!");

}

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, as long as the juggler is active, using the delayedCall method.

var delayedCall:DelayedCall = new DelayedCall(delayedHello, 3);

delayedCall.repeatCount = 0;

Starling.juggler.add(delayedCall);

For more information:

http://wiki.starling-framework.org/manual/animation 

http://doc.starling-framework.org/core/starling/animation/Juggler.html

Leave a Reply

Your email address will not be published. Required fields are marked *

Before you post, please prove you are sentient.

What color is the sky on a sunny day?

Before you post, please prove you are sentient.

What is 4 * 3?