Adobe Flex: Access To Undefined …

Flex users may get this error message quite a lot of times. That error message can pertain to either a method or a property. The cause? I came upon this problem because I used an inline Item Renderer for a DataGrid Column. I tried to access a variable not within the DataGrid component. This is because your Inline Item Renderer does not know what exists in your main application. Take this sample

This took me awhile to locate a solution. Luckily there is. Using outerDocument to call methods and/or variables will solve the problem. e.g. outerDocument.method_name()

Related Posts Plugin for WordPress, Blogger...

5 comments

  1. It seems that this works with inline ItemRenderers.

    But what if I’d like to catch an event fired by button that is part of external ItemRenderer? In such a case, outerDocument can’t be seen (Flex compiler says “Error: Access of undefined property outerDocument.”).

    Any hint for this?

    Dejan

  2. You rock!!!! I’ve been trying to figure out the same problem for a Chart item renderer for the past two hours! Thank you!

  3. I don’t agree with everything in this article, but you do make some very good points. I’m very interested in this topic and I myself do alot of research as well. Either way it was a well thoughtout and nice read so I figured I would leave you a comment. Feel free to check out my website sometime and let me know what you think.

Leave a Reply

Your email address will not be published. Required fields are marked *