Not yet rated

Problem

I used to have the easing effects working for mx:Move in Flex Builder 3. How are they translated in Flash Builder 4? Thanks.

Solution

You can add move,bounce and elastic effect inside the declaration tags inside your Flex 4 application. For more information take a look at the Flex 4 Help: Using Spark easing classes http://help.adobe.com/en_US/flex/using/WS91E85D63-A025-4c46-B758-A275D4D3B3FC.html

Detailed explanation

The application below imports easing classes by using the declaration tags.

They are then activated by the clickhandler

<?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:Script>
        <![CDATA[

            protected function button1_clickHandler(event:MouseEvent):void
            {
                moveRight.play();
                 
            }

        ]]>
    </fx:Script>

    <fx:Declarations>
        <s:Bounce id="bounceEasing"/>
        <s:Elastic id="elasticEasing"/>

        <s:Move id="moveRight"
                target="{flashLogo}"
                xBy="500"
                duration="2000"
                easer="{elasticEasing}"/>
       
        <s:Move id="moveLeft" target="{flashLogo}" xBy="500" duration="2000"/>
    </fx:Declarations>
 
    <mx:Image id="flashLogo" source="http://www.adobe.com/macromedia/style_guide/logos/flash_enabled/images/flash_enabled_logo_vertical.jpg"/>
    
    <s:Button label="Move Image" click="button1_clickHandler(event)"/>    
 

</s:Application>


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes