Skip navigation
dgassner
Currently Being Moderated

Example of Spark Wipe effect?

Jun 9, 2009 5:10 PM

Does anyone have an example of using the new Wipe effect outside the context of a transition?

Thanks,

David

  • Currently Being Moderated
    Adobe Employee
    Jun 9, 2009 7:15 PM

    could you please explain what you mean "Wipe effect outside the context of a transition"? what kind of examples are you looking for? thanks.

    |
    Mark as:
  • Currently Being Moderated
    Jun 9, 2009 7:48 PM

    David,

     

    The spark Wipe effect is different from its predecessor in the fact that it inherits from AnimateShaderTransition. This class specializes in animating shaders during a transition. There are ways to make it work outside of a transition, but the usage is awkward.

     

    Another roadblock you'll hit is if you try to use the old wipe effect on new spark components. Due to the addChild/addElement API change, an RTE will be raised.

     

    If you want the old behavior on a spark component, you can wrap the object with a Halo container and use that as the target of a Halo wipe (i.e. WipeRight). Here's an example:

     

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        xmlns:s="library://ns.adobe.com/flex/spark"
        width="300" height="300">

     

        <fx:Declarations>
            <mx:WipeRight id="wipe" />
        </fx:Declarations>

        <mx:Box id="box">
            <s:Button id="btn"
                x="0" y="0"
                width="150"
                label="Spark Button"
                click="wipe.play([box])"/>
        </mx:Box>

        <mx:Button id="btn2"
            x="0" y="50"
            width="150"
            label="Halo Button"
            click="wipe.play([btn2])"/>

    </s:Application>

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jun 10, 2009 3:32 PM

    And here's an update of your example with the non-transition usage. It can be done. However, it helps to match the size of the target and the bitmap you are going from etc. You avoid some of that awkwardness in your example by binding your rect size to the size of the bitmap. Anyhow, hope this helps a bit more. The animateShader classes are very powerful once you understand their usages:

     

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

     

        <fx:Script>
            <![CDATA[
                import spark.effects.WipeDirection;

                [Embed(source='asset/blue.png')]
                public var blueImage:Class;
                public var blueBitmap:Bitmap = new blueImage();
            ]]>
        </fx:Script>

     

        <fx:Declarations>
            <s:Wipe id="wipeIn"
            target="{wipeGraphic}"
            direction="{WipeDirection.RIGHT}"
            bitmapFrom="{blueBitmap.bitmapData}"/>
        </fx:Declarations>

     

        <s:Group id="g1"
        x="143" y="89">
            <s:Rect id="wipeGraphic"
            width="{blueBitmap.width}" height="{blueBitmap.height}">
                <s:fill>
                    <mx:SolidColor color="#EEEEEE"/>
                </s:fill>
            </s:Rect>
        </s:Group>

        <s:Button x="140" y="338"
        label="Play Effect"
        click="wipeIn.play()"/>

     

    </s:Application>

    Attachments:
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points