views:

335

answers:

1

I am working in Flex Builder 3 and I am trying to figure out this error. The error console reads "Access of undefined property EVENT." I am not understanding why this error is showing when I have already imported flash.events.Event. Flex is not recognizing with even the hinting helper pop up that appears when I type the addEventListener( . It should appear after the opening parenthesis right? Also, I cleaned the targets and still no luck. Thanks!

package {

    import flash.display.Sprite;
    import flash.events.Event;

    public class testing extends Sprite
    {
        public function testing()
        {
            addEventListener(EVENT.ENTER_FRAME, loop);
        }
        private function loop(e:Event):void
        {
        }
    }
}
+1  A: 

Actionscript is key sensitive

like this:

addEventListener(Event.ENTER_FRAME, loop);

not like this:

addEventListener(EVENT.ENTER_FRAME, loop);

wakey wakey :)

George Profenza
Thanks George....I stripped out my code and it's been a solid few hours straight. I knew it was something small. Happy New Year!
ninumedia
it's good to keep in mind that the convention for class names is Uppercase first letter then 'camelHumps'(words are separated by Uppercase on the new word) e.g. Event, ProgressEvent, etc. and constant should always be UPPERCASE like ENTER_FRAME, INIT, COMPLETE, etc. Usually constants in actionscript hold simple types like String, int, Number, etc. and class will always be a complex type (something extending at least Object). Happy New Year to you too ! :)
George Profenza