Skip to main content
Known Participant
April 24, 2006
Question

Using setTimeout to call an imported class function

  • April 24, 2006
  • 2 replies
  • 296 views
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?
This topic has been closed for replies.

2 replies

Inspiring
April 24, 2006
>>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.
Inspiring
April 24, 2006
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."