Share on Google+Share on Google+

Spark Wipe Effect in Flex4

Advertisement
The Wipe class defines a bar wipe effect. The before and after state of the component must be visible.

Spark Wipe Effect in Flex4:

The Wipe class defines a bar wipe effect. The before and after state of the component must be visible. This effect inherits the MaskEffect. The tag of Wipe Effect is <s:Wipe>. The syntax of Wipe effect is following:

<s:Wipe
id=""
duration=""
direction="left|right|up|down"
bitmapFrom=""
bitmapTo=""
target=""
/>

In this example you can see how we can use Wipe Effect in your application.

Example:

<?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"

minWidth="955" minHeight="600">

<fx:Declarations>

<s:Wipe id="wLeft"

duration="1000"

direction="left"

bitmapFrom="{image1Bitmap.bitmapData}"

bitmapTo="{image2Bitmap.bitmapData}"

repeatCount="0"

repeatBehavior="reverse"

target="{roseindia}"/>

</fx:Declarations>

<fx:Script>

<![CDATA[

import mx.core.BitmapAsset;

[Embed(source='file:/C:/work/bikrant/image/bridge.png')]

[Bindable]

public var Image1:Class;

[Bindable]

public var image1Bitmap:BitmapAsset = new Image1();

[Embed(source='file:/C:/work/bikrant/image/yellowglobe.png')]

[Bindable]

public var Image2:Class;

[Bindable]

public var image2Bitmap:BitmapAsset = new Image2();

]]>

</fx:Script>

<s:Panel title="Spark Wipe Effect Example"

width="433"

height="296"

chromeColor="#000000"

color="#CCCCCC">

<mx:ApplicationControlBar

width="432"

horizontalAlign="center">

<s:Button id="btn"

label="Wipe Effect"

click="{wLeft.end();wLeft.play();}"/>

<s:Button id="btn1"

label="Stop Effect"

click="{wLeft.stop();}"/>

</mx:ApplicationControlBar>

<s:Label text="Click on Buttons for showing the effect"

fontFamily="verdana"

color="#000000"

x="93" y="41"/>

<s:Label text="Wipe Left"

fontFamily="verdana"

color="#000000"

x="179" y="64"

height="13"/>

<mx:Image id="roseindia"

source="{Image1}"

x="141" y="101" cacheAsBitmap="true"/>

</s:Panel>

</s:Application>

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Advertisements

Posted on: July 6, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.