gpt4 book ai didi

apache-flex - 将变量绑定(bind)到 ItemRender 组件属性

转载 作者:行者123 更新时间:2023-12-04 03:05:22 24 4
gpt4 key购买 nike

我想将 ActionScript 中的变量绑定(bind)到 ItemRender 中组件的属性。但我总是收到此错误:

1120: Access of undefined property currentRoom.

这是我的代码

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:solutionItems="com.barco.components.ControlRoomConfigurator.solutionItems.*">
<mx:Script>
<![CDATA[
import com.barco.VO.ControlRoomConfigurator.Room;

[Bindable] private var myArrayCollection:ArrayCollection;
[Bindable] public var currentRoom:Room;


]]>
</mx:Script>
<mx:List id="listVideoWalls"
borderThickness="0"
dataProvider="{myArrayCollection}" >
<mx:itemRenderer>
<mx:Component>
<solutionItems:displaySolutionItem solutionId="{data.meetsRequirements.getItemAt(currentRoom.id)}" />
</mx:Component>
</mx:itemRenderer>
</mx:List>
</mx:Canvas>

我想在我的 ItemRenderer 组件中使用对象 currentRoom。你如何做到这一点?

希望您能理解我的问题。

谢谢!

文森特

最佳答案

问题是 <mx:Component>定义声明了一个新的范围。因此它无法直接访问当前的 mxml 文件范围。 <mx:Component>这只是原型(prototype)制作快速草稿的捷径。但从范围的角度来看,这与将组件提取到单独的文件中是一样的。所以提取它并停止混淆:)

关于apache-flex - 将变量绑定(bind)到 ItemRender 组件属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6014293/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com