我有一个中继器,用于创建名为“Block”的自定义组件。我需要这样做,以便当用户单击按钮时,由转发器创建的所有块都将其可见字段设置为false(然后再次单击该按钮时为true)。Flex 3:由中继器创建的隐藏元素
下面是一些代码,我现在所拥有的:
<mx:Repeater id="indPositions" dataProvider="{projectPositions}" startingIndex="0">
<components:block height="24"
width="100%" id="thisBlock" visible="true" horizontalScrollPolicy="off"
oneDay="{oneDay}"
/>
</mx:Repeater>
这里的按钮,用户会点击显示/隐藏块:
<mx:Button id="showHideButton" label="Show Project" x="{addBlock.x + addBlock.width + 2}" click="showProjectSwitch();" />
这里的功能showProjectSwitch():
public function showProjectSwitch():void {
if (showHideButton.label == "Hide Project")
{
showHideButton.label = "Show Project";
indPositions.visible = false;
thisProject.height = 65;
}
else
{
showHideButton.label = "Hide Project";
indPositions.visible = true;
thisProject.height = projectHeight ;
}
}
我试着设置projectRP.visible =“true/false”,但它没有工作:(
我也尝试在转发器周围包裹画布,但是当我这样做时...尽管事实上我有startIndex =“0”和count =“16”,但转发器只运行一次。然后我删除了画布标签,并且中继器运行了正确的次数。
有人能帮助我吗?
你能解释一下这个吗?不是组件类型,即使它是,我不知道我是否理解这将如何改变块的可见状态。 –
Brds
2011-04-27 20:38:17