在 flex 4 中切换状态
我在我的应用程序中使用了状态。问题是我已经选择了列表中的第一项。所以我这样给出,
if(itemIndex == 0)
this.currentState="selected";
这工作正常。问题是当选择其他项目时,第一个项目不会改变其状态,它保持在选定状态直到单击。 我的代码是这样的,
<s:BorderContainer id="outerCont" width="275" height="100" borderVisible="false"
backgroundColor.normal="#3D3C3C" backgroundAlpha.selected="0.1"
backgroundColor.selected="{data.color}">
我的状态是这样的,
<s:states>
<s:State name="normal" />
<s:State name="hovered" />
<s:State id="selState" name="selected" />
</s:states>
提前致谢!
I have used states in my application.The thing is I have made the first item in my list to be selected. so I gave like this,
if(itemIndex == 0)
this.currentState="selected";
this works fine.The problem is when other item is selected the first item does not change its state,it remains in the selected state until its clicked.
My code looks like this,
<s:BorderContainer id="outerCont" width="275" height="100" borderVisible="false"
backgroundColor.normal="#3D3C3C" backgroundAlpha.selected="0.1"
backgroundColor.selected="{data.color}">
My states are like this,
<s:states>
<s:State name="normal" />
<s:State name="hovered" />
<s:State id="selState" name="selected" />
</s:states>
Thanks in advance!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在更改状态的代码中,您永远不会更改回默认状态。所以,当itemIndex为0时;您设置为选定状态;但没有显示离开选定状态的代码。尝试这样的事情:
要在 Flex 列表中选择某些内容时更改状态,您可以使用更改事件:
这有帮助吗?如果不;你必须详细说明一下。
In your code for changing states, you never change back to a default state. So, when itemIndex is 0; you set to the selected state; but have no shown code to move away from the selected state. Try something like this:
To change state when something is selected in a Flex List you can use the change event:
Does that help? If not; you'll have to elaborate a bit more.