tags:

views:

71

answers:

1

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:transitions>

Thanks in advance!

+1  A: 

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;                
} 
Jason Towne
Thank you, this is exactly what I was looking to find out.
Impirator