簡體   English   中英

Flex,圖像交換鼠標懸停和狀態更改點擊

[英]Flex, image swap on mouse-over and state change on-click

我正在學習Flex並且想要在鼠標懸停時更改圖像,並在點擊時切換到另一個狀態。 我不想使用Flex中提供的任何按鈕。 有沒有人知道實現我想要的代碼? 謝謝

嘗試這樣的事情:

<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'"/>

我不明白你的意思是改變圖像上的狀態還是別的東西,但不管怎樣,這應該可以讓我們了解它是如何完成的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM