views:

15

answers:

1

When I'm building an composite animation, I'd like to specify the components as fractions of the parent, like so:

<s:Sequence id="example" duration="2000">
    <s:Fade alphaFrom="0" alphaTo="1" duration="10%"/>  <!-- not legal -->
    <s:Scale scaleXTo="2" scaleYTo="2"/>
    <s:Fade alphaFrom="1" alphaTo="0" duration="10%"/>
</s:Sequence>

Failing that, I use an expression like so:

<s:Sequence id="example" duration="{slideTime}">
    <s:Fade alphaFrom="0" alphaTo="1"  duration="{slideTime * .1}"/>
    <s:Scale scaleXTo="2" scaleYTo="2" duration="{slideTime * .9}"/>
    <s:Fade alphaFrom="1" alphaTo="0"  duration="{slideTime * .1}"/>
</s:Sequence>

Is there a more declarative way to accomplish this? In the latter case, for instance, can I at least replace the variable slideTime with a direct reference to the parent's duration?

Thanks.

+1  A: 

In the latter case, for instance, can I at least replace the variable slideTime with a direct reference to the parent's duration?

Does this work / solve it?:

<s:Sequence id="example" duration="500">
    <s:Fade alphaFrom="0" alphaTo="1"  duration="{example.duration * .1}"/>
    <s:Scale scaleXTo="2" scaleYTo="2" duration="{example.duration * .9}"/>
    <s:Fade alphaFrom="1" alphaTo="0"  duration="{example.duration * .1}"/>
</s:Sequence>
Marty Pitt
It does, but I was looking for a way to write these expressions consistently across animations. Sorry for such a noob question (I just started Flex), but unless there's a general way to grab the parent animation in that context, this will be the best answer.
harpo
Yeah, there's no simpler or more general way to express this. I cannot find any official documentation on it, but someone claimed (I forgot where) that setting the duration on a CompositeEffect will set the same duration for all of its children. That makes sense for *Parallel*, but I was just reaching for a more CSS-like approach for *Sequence*. Moving on.
harpo