1 Reply Latest reply on Apr 22, 2006 7:35 PM by DuhChamp

    Using setTImeout to create effect of dealing cards

      As my code stands right now, I can deal cards to the proper location and move at a steady speed, but they all move at the same time. Now, I want to add the effect of them being dealt by using the setTimeout method to offset the times they are dealt. However, when I call the setTimeout method, it only works on the last card and jumps the card to its destination instead of slowly moving it there as if it were dealt. Figure A shows my working code without the setTimeout method, and Figure B shows my code with the setTimeout method.

      I have a hunch that it is not working either because it overwrites the myTimeout variable that holds the setTimeout id, or because of the this (i may need to create an empty movie clip on the root timeline to hold the value of setTimeout) in the setTimeout line, but I do not know why it removes my tween effect.

      My motion code can be seen in FIGURE C.
        • 1. Re: Using setTImeout to create effect of dealing cards
          DuhChamp Level 1
          By the way, these function are members of my TexHoldem class. I've read a bunch of posts about how to use the setTimeout function, but I'm not sure if I'm doing it correctly inside of a class.

          In my latest attempt, I tried creating a controller that would hold the instances of the timeouts incase they were overwriting themselves on the timeline, but I get the same results. Here is that code (snippet of entire code, under if (seat >=10) statement in distributeHoleCards function.

          I've also tried to create an array which would store the intervals so they would not be destroyed, but still no luck.