Tip: Flex/AS3 keyboardEvent listener

If you are writing a flex app, you might get this error TypeError: Error #1009: Cannot access a property or method of a null object reference. if you do, it simply means that you are trying to do something with an object that hasn’t yet been created. If that object is the stage, then you are probably calling an init funtion on creationComplete. If you change this to applicationComplete, you’ll have the stage present.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();" ... >

About Jason

I am a 26 year old programmer living in the south of France. I currently work actively in the fields of Ruby/PHP/Javascript and server/website administration.
This entry was posted in ActionScript 3 Tutorials, Computer Science, Flex/AIR Tutorials, Tips and Tricks and tagged , , , . Bookmark the permalink.