I am learning Flex and have an image I would like to changed on mouseover, and switch to another state on click. I do not want to use any of the buttons available in 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.