Flex 3: How does one access an object in an mxml file in the constructor of a class that extends it?
I have extended an mxml component with an actionscript class. I'm trying t开发者_开发技巧o access a component in the mxml file using the id (in order to add an event listener) but I cant seem to do it.
I get:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
Anyone know what I'm doing wrong?
Where exactly in your code are you trying to access the component? If it's before createChildren() is called, it won't exist yet.
If you're not familiar with the flex component lifecycle, you'll need to learn about it, it's an integral part of developing efficient flex components.
精彩评论