3 Replies Latest reply on Jun 13, 2006 5:39 AM by Wolf_van_Ween

    counter that won't work

    juanfhj
      I want to create a movie that constantly shows the value of a variable that is changing. I tried the code below, but it won't work.

      What am I missing?

      Regards

      Juan Herrera

        • 1. Re: counter that won't work
          Wolf_van_Ween Level 1
          A number of problems with this.
          First, myText.variable is of type string, not Number. This could be easily solved. However,
          Second, your loop is constantly processing, so Flash has no time to update the screen. Need to use updateAfterEvent(). This however only works in certain settings, and not in a fast loop, so you need to allow for some time in between.
          If you want to have a count-up, use something like the attached code.
          • 2. Re: counter that won't work
            juanfhj Level 1
            Thanks. Your code worked fine with my application. Correct me if I'm wrong, this is a thread, right? How could I refresh the display along with the main thread?
            • 3. Re: counter that won't work
              Wolf_van_Ween Level 1
              That depends on your definition of thread. Macromedia doesn't call it that way, and I guess it's not for purists, who see threads as something having a separate memory space, environment etc.
              As for refreshing the display in the "main thread", you're in very thin air there. Read the description of updateAfterEvent in the help file and you'll see that Macromedia was very selective with its use. I guess the reason is that keeping the normal frame refresh working regularly was more important for an animation-based software than a sophisticated event machinery.