开发者

Flex 3: How does one access an object in an mxml file in the constructor of a class that extends it?

开发者 https://www.devze.com 2022-12-29 22:17 出处:网络
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 i

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号