Thanks guys! I had two instances of the class and two event listeners running one after the other.
On Wed, Jan 7, 2009 at 10:15 AM, Tracy Spratt <[email protected]> wrote: > You should not attempt any complex assignments or run any functions > outside of a function. > > Tracy > > > ------------------------------ > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of *Paul Andrews > *Sent:* Wednesday, January 07, 2009 3:34 AM > *To:* [email protected] > *Subject:* Re: [flexcoders]Scope issue - class variable not set > > > > ----- Original Message ----- > > *From:* dorkie dork from dorktown <[email protected]> > > *To:* [email protected] > > *Sent:* Wednesday, January 07, 2009 8:08 AM > > *Subject:* [flexcoders]Scope issue - class variable not set > > > > Hi all, > It seems setting a class variable is not happening until after all my code > is run. > > When I do this: > > this.anchorName = anchorName; > setState(stateName); > > the class variable "anchorName" isn't set. > the setState method is called and then the method is exited. > then the debugger loops back into the same method again like it wasn't > called but this time the class level variable is set before hand? > > What is going on? > > > > It's difficullt to tell from your snippet. You refer to a class variable > yet you are setting an instance variable and there is no context about how > that code is called, whether it's an instance method or a class method. Your > use of 'this' implies an instance method and if you are assuming that the > unqualified anchorName refers to a class method, you would be wrong. Your > assignment is setting the same instance variable to itself. To refer to the > class instance inside the instance method use MyClassName.anchorName. > > > > Paul > > > > dorkie dork from twilight zone town > > >

