Simple question about Task( )

    Oct 30 2011 | 2:07 am
    I'm trying to animate a change in a [panel]'s presentation_rect. After some reading and experimentation, I figured the Task() object would be the most appropriate way to go. But I'm having trouble changing the arguments...
    var tsk;
    var args;
    function init() {
            args = new Array();
    	args[0] = "tick";
    	tsk = new Task(dummy, this, args);
    	tsk.interval = 1000;
    function dummy(s) {
    	if(s=="tick") args[0] = "tock";
    	if(s=="tock") args[0] = "tick";
    It seems that args[0] always contains "tick" and never a "tock". As if the initialization of Task() takes in the values of args[] upon creation, instead of checking the pointer during each interval. Or am I missing something?
    Either way, i'd like to know how to get around this, or some other scripting method I could use to delay a change in an object's attributes. Any thoughts?

    • Oct 31 2011 | 2:55 am
      if(s=="tick") args[0] = "tock";
      if(s=="tock") args[0] = "tick";
      methinks you want an "else" in front of the second if.
    • Oct 31 2011 | 6:05 am
      Thanks Brian! 346 lines of working code and I miss a simple 'else' statement lol