1 Reply Latest reply on Dec 31, 2007 9:46 PM by Chaos7703

    Strange behavior with subtraction

      I have an app that is using three timers to control various events. The three timers stop & start each other depending on various numeric relations. I have three functions that differ only by numbers that correspond to which timer is using which var. That is, there is function1():void{value1 = this1- var1;}, function2():void{value2 = this2 - var2;}, function3():void{value3 = this3 - var3;} But for some strange reason when function3 has this3 - var3 the timer starts and stops randomly (it's not really random, but I don't know what it's caused by, I've checked). When I wrote the functions, they originally had this? + var? and all three worked, but were calculating the wrong values. They needed to be this? - var? and when I made the change only to function1 at first it wouldn't work either. After about 7-8 tries all of the sudden Flex "?remembered how to subtract?" and it started working & it does what it should. So I applied the same change to all the functions. function2 gave no problem, but function3 won't work unless I change it back to a + (which calculates the wrong numbers).

      Anybody have any ideas???

      Thanks! Happy New Year (in about 30 mins here)!!!!!!!!!!!
        • 1. Re: Strange behavior with subtraction
          Chaos7703 Level 1
          Sorry, never mind, one of the variables in a conditional didn't get changed in function3. The end result was two timers fighting over whether or not the third timer was on or off--kinda like two kids playing with a light switch (and with a 1ms timer delay & 1000 switches a second it's a good thing that it was only a virtual switch!).

          Happy Coding in the New Year!