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
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<mx:AdvancedDataGridColumn width="140"> <mx:itemRenderer > <mx:Component> <mx:HBox> <mx:Script> <![CDATA[ import mx.controls.Alert; ]]> </mx:Script> <mx:LinkButton label="show" click="Alert.show(outerDocument.userlist.lastResult.userid)"/> </mx:HBox> </mx:Component> </mx:itemRenderer> </mx:AdvancedDataGridColumn> |
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()
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
hi dejan. im sorry, i have not tried catching an event fired by the button. i will post a comment if ever ill get to this point.
You rock!!!! I’ve been trying to figure out the same problem for a Chart item renderer for the past two hours! Thank you!
you’re welcome derrick. glad this post helped you.
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.