Flex:为什么 DataGroup ItemRenderer 的 mouseOut 会导致状态更改?
当我将鼠标移出 itemRenderer 时,我发现 Flex 4 中的 DataGroup 中的 itemRenderer 有一个非常烦人的问题,该问题返回到其默认状态。下面是一个示例:
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:BorderContainer>
<s:DataGroup>
<s:layout>
<s:VerticalLayout gap="1"/>
</s:layout>
<s:dataProvider>
<s:ArrayCollection>
<fx:Object title="One" />
<fx:Object title="Two" />
<fx:Object title="Three" />
</s:ArrayCollection>
</s:dataProvider>
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<s:states>
<s:State name="expanded" />
<s:State name="collapsed" />
</s:states>
<fx:Script>
<![CDATA[
private function expandCollapse():void
{
currentState = (currentState == "collapsed") ? "expanded" : "collapsed";
}
]]>
</fx:Script>
<s:VGroup>
<mx:Button click="expandCollapse();" label="Click me to hide the number" />
<s:SkinnableContainer>
<s:VGroup height="0" height.expanded="NaN">
<s:Label text="{data.title}" />
</s:VGroup>
</s:SkinnableContainer>
</s:VGroup>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:DataGroup>
</s:BorderContainer>
</s:Application>
当用户单击按钮时,VGroup 按预期折叠,但如果用户将鼠标移出项目渲染器,VGroup 就会折叠,即返回到其默认状态。
这是一个错误还是我在这里遗漏了一些东西?
干杯,
克里斯
I've found a very annoying problem with the itemRenderers in a DataGroup in flex 4, when I mouseout of the itemRenderer is returns to its default state. Here's an example:
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:BorderContainer>
<s:DataGroup>
<s:layout>
<s:VerticalLayout gap="1"/>
</s:layout>
<s:dataProvider>
<s:ArrayCollection>
<fx:Object title="One" />
<fx:Object title="Two" />
<fx:Object title="Three" />
</s:ArrayCollection>
</s:dataProvider>
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<s:states>
<s:State name="expanded" />
<s:State name="collapsed" />
</s:states>
<fx:Script>
<![CDATA[
private function expandCollapse():void
{
currentState = (currentState == "collapsed") ? "expanded" : "collapsed";
}
]]>
</fx:Script>
<s:VGroup>
<mx:Button click="expandCollapse();" label="Click me to hide the number" />
<s:SkinnableContainer>
<s:VGroup height="0" height.expanded="NaN">
<s:Label text="{data.title}" />
</s:VGroup>
</s:SkinnableContainer>
</s:VGroup>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:DataGroup>
</s:BorderContainer>
</s:Application>
When the user clicks on the button the VGroup is collapsed as expected, but then if a user moves their mouse out of the item renderer it then collapses, i.e. returns to its default state.
Is this a bug or am I missing something here?
Cheers,
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,ItemRenderer 已经拥有了一些自己的状态。如果我们使用 DataRenderer 而不是 ItemRenderer,此示例将按预期工作。
It turns out that ItemRenderer already has some of its own states. This example works as expected if we use a DataRenderer instead of an ItemRenderer.