错误1120:访问未定义的属性 [英] Error 1120: Access of undefined property

查看:198
本文介绍了错误1120:访问未定义的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在主文件中定义了一个< mx:Script>
<$ p
$ {
$'$'$'$'$'''''''''''''''''''''''' :'RAL1013','hex':'E8E4CD'},
{'prx':'am','nmb':'Amarillo','ral':'RAL1005','hex':'C79E03' },
{'prx':'gr','nmb':'Gris Perla','ral':'RAL7045','hex':'8E939E'}
]);

我可以在很多地方将它用作dataProvider,但不在这里:

 < mx:TileList dataProvider ={dpCols}> 
< mx:itemRenderer>
< mx:Component>
< mx:Box backgroundColor ={int('0x'+ data.hex)}
height =64width =72>
< mx:Label text ={data.ral}textAlign =centerwidth =100%/>
< / mx:Box>
< / mx:Component>
< / mx:itemRenderer>
< / mx:TileList>

此TileList位于< radg:RaDG> (我的AdvancedDataGrid的子类),< radg:columns> < mx:AdvancedDataGridColumn> < mx:itemEditor> < mx:Component> 。如果我把它放在外面,那就行了。但是我需要把它放在itemEditor中。

我应该如何引用 dpCols 然后呢? (或者我怎么解决这个错误?)

谢谢! 解决方案

p>您需要 outerDocument < mx:Component> 标记内。请参阅此Adobe中的使用组件标记部分文档页面或此 SO问题。如果你在嵌套方面变得特别棘手,你可能需要使用 parentDocument ,但听起来像 outerDocument 应该适用于您的情况(只有一个嵌套< mx:Component> 标签)。 b

用法:

 < mx:TileList dataProvider ={outerDocument.dpCols}/> ; 


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'}
 ]);

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>

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.

How should I refer to dpCols then? (or how can I solve this error?)

Thanks!

解决方案

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.

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).

Usage:

<mx:TileList dataProvider="{outerDocument.dpCols}" />

这篇关于错误1120:访问未定义的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆