开发者

Possible to reuse Effects by id in MXML Transition?

I'm sure this question has been asked before, but I'm just not sure how to search for it (kind of like trying to search for the this operator...ugh).

I have a <mx:Dissolve id="dissolveOut" ... /> Effect in an Flex page I'm working on, and I would like to reuse this effect in a <mx:Transition> sequence. Is there a way to call dissolveOut from MXML inside the Transition tag, or do I really just have to duplicate code?

<mx:Dissolve id="dissolveOut" alphaFrom="1" alphaTo="0" duration="2000" />

<mx:transitions>
    <mx:Transition fromState="*" toState="*">
        <mx:Sequence>
            <mx:Dissolve <!-- I want to replace with `dissolveOut' somehow -->
                alphaFrom="1" alphaTo="0"
                duration="2000" />
        </mx:Sequence>
    </mx:Transition>
</mx:t开发者_StackOverflowransitions>

Thanks in advance!


As far I know, unless you're going to create the transition dynamically, there's no way to reuse a static control as part of a transition or in another control.

In the past, I've built the transition effect dynamically as the transition was called. Here's a quick example on how to build a transition effect dynamically:

public function SetTransitionEffects():Parallel
{
  var parOut:Parallel = new Parallel();     
  var moveOut:Move = new Move();
  var wipeRight:WipeRight = new WipeRight();

  moveOut.xFrom = 0;
  moveOut.xTo = -750;
  moveOut.duration = 500;

  wipeRight.duration = 500;

  parOut.addChild(wipeRight);
  parOut.addChild(moveOut);

  return parOut;                
} 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜