This content has been marked as final. Show 3 replies
In your EventListenerList constructor, remove the "var". What you did was declare a local variable called "listeners" and initialized that. The listeners property never got initialized.
Thank you for the response.
Placing the var there was actually an act of desperation. The initial code refered to the class private property listeners. I have removed the var so I now have
public function EventListenerList ()
listeners = new Array();
and yet I still get an error for
var len:Number = listeners.length
//Description Access of undefined property length in package listeners. EventListenerList.as
This error is same for every argument in the class document that has any reference to that array
Also I find that the code hints only give me options for classes and interfaces within the events package. I cannot get access to the Top Level Classes. I'd appreciate your help here.
The first problem is that Flex is getting your class variable listeners very confused with the package listeners. If you rename your class level var to something else, the error message goes away.
Now I'm intrigued as to what this code is supposed to do...
What is switch(listeners) supposed to do? If you're comparing it to a number, houldn't that be listeners.length?