Skip to main content
Participant
April 7, 2007
Answered

Scope of a listener within a class

  • April 7, 2007
  • 2 replies
  • 261 views
Here i am again.
I've wrote a class that manages the input from keyboard. It associates a button to an action and sends it to an object.
The problem appears at the key listener object.
At the constructor i define the variables of the class, but i can't access them from within the listener.

I've searched all this forum, found similar problems with no satisfactory answer. And the google didn't help too

How do i access these vars?
This topic has been closed for replies.
Correct answer
you have a scope problem and there's several ways to solve this problem. Here's the two I suggest to you base on the code you post...

you can also use Mike Chamber's class : Delegate. This class is shipped with Flash IDE since Flash 7.2(Flash Mx 2004 update 2)


2 replies

Participant
April 7, 2007
Thanks man, it worked fine
Correct answer
April 7, 2007
you have a scope problem and there's several ways to solve this problem. Here's the two I suggest to you base on the code you post...

you can also use Mike Chamber's class : Delegate. This class is shipped with Flash IDE since Flash 7.2(Flash Mx 2004 update 2)