[英]Flex, image swap on mouse-over and state change on-click
I am learning Flex and have an image I would like to changed on mouseover, and switch to another state on click. 我正在学习Flex并且想要在鼠标悬停时更改图像,并在点击时切换到另一个状态。 I do not want to use any of the buttons available in Flex.
我不想使用Flex中提供的任何按钮。 Does anyone know th code to achiev what I want?
有没有人知道实现我想要的代码? Thanks
谢谢
Try something like this: 尝试这样的事情:
<fx:Declarations>
<s:BitmapImage id="imageOut" source="@Embed('images/button.png')" />
<s:BitmapImage id="imageOver" source="@Embed('images/button-over.png')" />
</fx:Declarations>
<s:Image id="imageButton" source="{imageOut.source}"
rollOver="imageButton.source = imageOver.source"
rollOut="imageButton.source = imageOut.source"
click="someObject.currentState = 'someState'"/>
I don't understand if you mean changing the state on the Image or on something else, but either way, this should provide a sense of how it might be done. 我不明白你的意思是改变图像上的状态还是别的东西,但不管怎样,这应该可以让我们了解它是如何完成的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.