- Adobe Flex 教程
- Flex - 首頁
- Flex - 概述
- Flex - 環境
- Flex - 應用程式
- Flex - 建立應用程式
- Flex - 部署應用程式
- Flex - 生命週期階段
- Flex - 使用 CSS 樣式
- Flex - 使用皮膚樣式
- Flex - 資料繫結
- Flex - 基本控制元件
- Flex - 表單控制元件
- Flex - 複雜控制元件
- Flex - 佈局面板
- Flex - 視覺效果
- Flex - 事件處理
- Flex - 自定義控制元件
- Flex - RPC 服務
- Flex - FlexUnit 整合
- Flex - 除錯應用程式
- Flex - 國際化
- Flex - 列印支援
- Adobe Flex 資源
- Flex - 快速指南
- Flex - 有用資源
- Flex - 討論
Flex - 向右擦除效果
簡介
WipeRight 類定義了一個向右擦除的效果。元件的之前或之後狀態必須不可見。
類宣告
以下是 **mx.effects.WipeRight** 類的宣告:
public class WipeRight extends MaskEffects
公共方法
| 序號 | 方法及描述 |
|---|---|
| 1 | WipeRight(target:Object = null) 建構函式。 |
繼承的方法
此類繼承自以下類的方法:
- mx.effects.MaskEffect
- mx.effects.Effect
- flash.events.EventDispatcher
- Object
Flex 向右擦除效果示例
讓我們按照以下步驟來檢查在 Flex 應用程式中使用 WipeRight 效果,方法是建立一個測試應用程式:
| 步驟 | 描述 |
|---|---|
| 1 | 建立一個名為 *HelloWorld* 的專案,放在 *com.tutorialspoint.client* 包下,如“Flex - 建立應用程式”一章中所述。 |
| 2 | 修改 *HelloWorld.mxml*,如下所述。保持其餘檔案不變。 |
| 3 | 編譯並執行應用程式,以確保業務邏輯按要求工作。 |
以下是修改後的 mxml 檔案 **src/com.tutorialspoint/HelloWorld.mxml** 的內容。
<?xml version = "1.0" encoding = "utf-8"?>
<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
width = "100%" height = "100%" minWidth = "500" minHeight = "500">
<fx:Style source = "/com/tutorialspoint/client/Style.css" />
<fx:Script>
<![CDATA[
protected function btnWipeRight_clickHandler
(event:MouseEvent):void {
imageFlex.visible = true;
}
]]>
</fx:Script>
<fx:Declarations>
<mx:WipeRight id = "wipeRight" duration = "2000" />
</fx:Declarations>
<s:BorderContainer width = "630" height = "480" id = "mainContainer"
styleName = "container">
<s:VGroup width = "100%" height = "100%" gap = "50"
horizontalAlign = "center" verticalAlign = "middle">
<s:Label id = "lblHeader" text = "Effects Demonstration"
fontSize = "40" color = "0x777777" styleName = "heading" />
<s:Panel id = "wipeRightPanel" title = "Using WipeRight Effect"
width = "500" height = "300" includeInLayout = "true" visible = "true">
<s:layout>
<s:VerticalLayout gap = "10" verticalAlign = "middle"
horizontalAlign = "center" />
</s:layout>
<mx:Image id = "imageFlex" visible = "{false}"
source = "https://tutorialspoint.tw/images/flex-mini.png"
showEffect = "{wipeRight}" />
<s:Button id = "btnWipeRight" label = "Wipe Right"
click = "btnWipeRight_clickHandler(event)" />
</s:Panel>
</s:VGroup>
</s:BorderContainer>
</s:Application>
準備好所有更改後,讓我們像在Flex - 建立應用程式一章中一樣,在普通模式下編譯並執行應用程式。如果您的應用程式一切正常,它將產生以下結果:[ 線上試用 ]
flex_visual_effects.htm
廣告