[thelist] advanced JS question - object scope issue perhaps

Tom Dell'Aringa pixelmech at yahoo.com
Wed Apr 20 10:26:33 CDT 2005


--- Sam Foster <sam at sam-i-am.com> wrote:
> hi Tom,
> I didn't see any reply to this, and I'm not sure if you got it already.. 
> but here's a couple of thoughts.
[snip]
> Show is called as an object method, but when the setTimeout evals the 
> anonymous function, oContainer is out of scope. You need to assign 
> oContainer as a property of your object, and refer to that object by 
> name (not 'this'.. this is also out of scope when the setTimeout evals).
> 
> ... I think. Does that help, did you arrive at the same place?

Thanks for the comment Sam - turns out though I simply had my methods outside the class, instead
of inside. They were out of scope. I moved them inside and all was rosey. It's the simple things
that sometimes trip you up!

Tom


http://www.pixelmech.com/

Melissa: Ace, Where are you?
Ace Ventura: I'm in Psychoville and Finkle's the Mayor.



More information about the thelist mailing list