问题描述
我在主文件上有一个 ,我在其中定义了这个:
I have a <mx:Script>
on the main file, where I define this:
[Bindable]
private var dpCols:ArrayCollection = new ArrayCollection([
{'prx':'bl', 'nmb':'Blanco', 'ral':'RAL1013', 'hex':'E8E4CD'},
{'prx':'am', 'nmb':'Amarillo', 'ral':'RAL1005', 'hex':'C79E03'},
{'prx':'gr', 'nmb':'Gris Perla', 'ral':'RAL7045', 'hex':'8E939E'}
]);
我可以在很多地方使用它作为 dataProvider,但不能在这里:
I can use it as a dataProvider in many places, but not here:
<mx:TileList dataProvider="{dpCols}">
<mx:itemRenderer>
<mx:Component>
<mx:Box backgroundColor="{int('0x' + data.hex)}"
height="64" width="72">
<mx:Label text="{data.ral}" textAlign="center" width="100%"/>
<mx:Label text="{data.nmb}" textAlign="center" width="100%"/>
</mx:Box>
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
此 TileList 位于 (我的 AdvancedDataGrid 子类)、
、
;
、 和
.如果我把它放在外面,它就可以工作.但我需要它来放置 itemEditor.
This TileList is within a <radg:RaDG>
(my subclass for AdvancedDataGrid), <radg:columns>
, <mx:AdvancedDataGridColumn>
, <mx:itemEditor>
and <mx:Component>
. If I put it outside, it just works. But I need it to put it has the itemEditor.
那我应该如何引用dpCols
?(或者我该如何解决这个错误?)
How should I refer to dpCols
then? (or how can I solve this error?)
谢谢!
推荐答案
您需要 outerDocument
,因为您位于 标签内.请参阅此 Adobe 中的使用组件标记"部分文档页面或这个SO问题.
You need outerDocument
, since you're inside the <mx:Component>
tag. See the "Using the Component Tag" section in this Adobe docs page or this SO question.
如果您对嵌套特别棘手,您可能需要使用 parentDocument
代替,但听起来 outerDocument
应该适用于您的情况(只有一个 嵌套;
标签).
If you're getting particularly tricky with nesting, you may need to use parentDocument
instead, but it sounds like outerDocument
should work in your case (only one nesting of <mx:Component>
tags).
用法:
<mx:TileList dataProvider="{outerDocument.dpCols}" />
这篇关于错误 1120:访问未定义的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!