2 Replies Latest reply on May 19, 2007 11:13 AM by Jamesabth

    variables... am I barking up the wrong tree?

    frankmat
      I'm a bit confused... basically what I am doing is creating a movie where I am doing this.lineto to create lines between certain spots on a map. I want these lines to display at different times so this is what Ive decided to do:

      1. Frame 1 create an array with the x and y co-ords and the time I want them to display in seconds. eg: x = 100,y = 50, secs = 6
      2. On Frame 1 I create a global variable _global.secondcount = 0; AND I create a function called drawLine(); which creates a this.lineto to draw a line.
      3. On Frame 30 I increment the secs variable by 1 by doing _global.secondcount = _global.secondcount + 1 and then gotoandplay frame 5.
      4. On Frame 5 I check to see what the _global.secondcount is and if it equates to the secs variable in my array. To test this I hardcoded it to this below where drawLine is the function to draw the line.

      quote:

      if (_global.secondcount == 6) {
      drawLine();
      trace("I've found count 6");
      }
      trace(_global.secondcount)


      Now when I trace the output the global variable is counting correctly.. BUT for some reason the drawLine() isn't being called.. The trace "I've found count 6") also displays as well... it just doesn't call this function. Would there be a reason for this? Funnily enough when I change it so that it plays the function if the count is 0 it works..... so it seems that once it gets to the 30th frame and loops back to the 5th frame it seems to no longer find the drawLine(); function I created in frame 1.

      Does anyone know why? Sorry but I'm a relative noob to this and its frustrating me.