Thanks for both of the posts! So...if I put "setInterval(function() { yourgetJSONfunction; }, 60000)" in composition.ready on the stage, then it will call at intervals continuously? And if I add that to an onclick function it will wait until the first click and then refresh at those intervals until the symbol is deleted?

Basically like: create animated wind speed symbol, then have it update every so often...and have it deleted and replaced by a temp symbol if the temp is clicked. That's a basic example.

Push notifications are also possible this way, right? Hoping to use it in PhoneGap to make quick prototypes.

Thanks again and thanks in advance for clarifying! This is starting to get really cool.

This, I mean, initially...to set an interval that refreshes at intervals after page loads:

setInterval(function() { yourgetJSONfunction; }, 100);

Time interval in milliseconds.

And then if I wanted to initiate that on a click, I'd add it to a click event? Would it run at an interval of 100 continuously, when launched by click?

I guess the basic question is: Will this code somehow update at the intervals, regardless of where the code is placed? Or is composition.ready the only place where code like this runs properly?

I am used to interactive products like Unity where there is a way to call functions on every frame, and the frames run constantly, regardless of any activity happening. I suppose if I put the function on a trigger that loops, and always have the timeline active, then it would update for sure.

If you put it into composition.ready, it will then repeat until you stop it. I won't say you can't put it anywhere else because that depends on what you need, but its easier to understand the scope of your functions if they're attached to the Stage, particularly those that you want to call on from various elements within the composition.

If you add it to a click event, be sure to clearInterval() otherwise you'll have multiple functions queuing up, e.g.

sym.$('element').on('click',function(){

clearInterval(myInterval);

myInterval=setInterval(function(){ doSomething; },60000);

});

Don't put setInterval() on a looping timeline though, you'd either get multiple events queuing up, or you'll end up clearing the interval (and cancelling the event) before its actually happened. But, if you want to use a timeline loop, you wouldn't need setInterval() or setTimeout() anyway, you could just fire the event each time the timeline reaches the trigger.