cammil
cammil

Reputation: 9899

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 to 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?

Upvotes: 0

Views: 299

Answers (1)

quoo
quoo

Reputation: 6307

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.

Upvotes: 1

Related Questions