2 Replies Latest reply on Apr 24, 2006 1:03 PM by Peter Lorent

    Using setTimeout to call an imported class function

    DuhChamp
      I'm trying to call an imported class function using the setTimeout method. Here is what my code looks like now:

      setTimeout(myTex.getAction, 5000, seat);

      It is not working, though. Anyone know how this should look?
        • 1. Re: Using setTimeout to call an imported class function
          Level 7
          DuhChamp,

          > I'm trying to call an imported class function using the
          > setTimeout method.

          setTimeout() is a function, not a method. And you'd be calling an
          imported class method, not a function. But I hear ya.

          > Here is what my code looks like now:
          >
          > setTimeout(myTex.getAction, 5000, seat);
          >
          > It is not working, though. Anyone know how this should look?

          Since setTimeout() isn't documented -- even though it *is* a documented
          function -- it's hard to know for sure. Perhaps it only invokes functions
          rather than methods. I honestly don't know.

          That said (caveats aside), what about this?

          setTimeout(function() {myTex.getAction(seat);}, 5000);

          ... assuming, of course, that myTex and seat are visible from this scope.


          David
          stiller (at) quip (dot) net
          Dev essays: http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Using setTimeout to call an imported class function
            Peter Lorent Level 2
            >>setTimeout(myTex.getAction, 5000, seat);
            That should work. Did you import the class on the same frame? And, you won't be able to access instance props this way. But that's a side note.