开发者

Problem getting in Flex Effects: Migration from Flex3 to Flex4

开发者 https://www.devze.com 2023-03-20 21:11 出处:网络
I am using Flex4. I want to get some animation effects in my project. I used <s:Wipe> but this doesn\'t work, however with same type of code, <mx:WipeLeft> worked.

I am using Flex4. I want to get some animation effects in my project.

I used <s:Wipe> but this doesn't work, however with same type of code, <mx:WipeLeft> worked. However I dont wa开发者_如何学Pythonnt to use <mx> code, if its more-generic spark code is available in Flex4.

My both type of codes are:

MX Code- (working code)

<mx:WipeLeft id="wLeft" duration="1500" target="{imgSinglePage}"/>

Spark code- (Not working)

<s:Wipe id="wLeft" duration="1500" direction="left" target="{imgSinglePage}"/>


Effects can work with transitions using Flex 4's state system, or can be triggered by events in components.

Specified in a declarative way:

    <!--- Fade effects for showing / hiding elements -->
    <fx:Declarations>
        <s:Parallel id="fadeInEffect">
            <s:Fade alphaFrom="0"
                    alphaTo="1" />
        </s:Parallel>
        <s:Parallel id="fadeOutEffect">
            <s:Fade alphaFrom="1"
                    alphaTo="0" />
        </s:Parallel>
    </fx:Declarations>


    <!-- Image -->
    <s:Image showEffect="{fadeInEffect}"
             hideEffect="{fadeOutEffect}" />

If this does not answer your question, please provide code that uses the effect you have referenced.


There is nothing in your declaration of the effects themselves that is causing your problem. Since you didn't include your actual invocation code, I can only guess that you are attempting to use an effects trigger (eg. rollOverEffect="wLeft") to execute the Spark effect.

The Spark effects can only be invoked by calling their play() method. So in your case, you would use

... rollOver="wLeft.end();wLeft.play();" ...

on the relevant component.

Here's the official Adobe description.

And here's a discussion on SO of the same problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消