4 Replies Latest reply on Jun 22, 2009 11:56 AM by David_F57

    Troubles with Sequences

    David_F57 Level 5

      I have tried unsuccessfully to use different methods in gumbo to replace tweenmax and had very little success the closest I have come is with parallel sequences but still not really achieving what I was hoping to do , targeting objects is the first issue(even with sequencing) as the only way I have suceeded so far is to target an object before playing a sequence as below, but I want to include multiple targets within a series of effects and declaring the target within a sequence just fails.

       

      PageL.rotationY=180;

      flipper.target=paperMod;

      flipper.play();

      TweenMax.to(PageL,2,{rotationY:1, delay:0.100});   <------ I really don't want this here

       

       

      this is the sequence

       

      <mx:Sequence id="flipper">
      <mx:Parallel duration="500">
      <mx:AnimateProperty property="force" fromValue="0" toValue="1.8"/>
      <mx:AnimateProperty property="angle" fromValue="-1.00" toValue="-0.25"/>
      <mx:AnimateProperty property="offset" fromValue="1" toValue="0.3"/>
      </mx:Parallel>
        
      <mx:Parallel duration="750">
      <mx:AnimateProperty property="force" toValue="0" fromValue="1.8"/>
      <mx:AnimateProperty property="angle" toValue="-1.00" fromValue="-0.25"/>
      <mx:AnimateProperty property="offset" toValue="1" fromValue="0.3"/>
      </mx:Parallel>
      </mx:Sequence>
      this is the tweening I want to replace
      protected function button2_clickHandler(event:MouseEvent):void
      {
      PageL.rotationY=180;
      paperMod.force = 0;
      paperMod.offset = 0.95;
      paperMod.angle =  0;
      rev=true;
      myTween = new TweenMax(paperMod, 0.75, {force:1.7, offset:0.22, angle:-0.35, bezier:[{offset:1.2, angle:-0.7, force:1}],
      onComplete:reverseMe});
      TweenMax.to(PageL,2,{rotationY:1, delay:0.100});
      }
      private function reverseMe():void
      {
      if (rev==true)
      {
      rev=false;
      myTween.reverse(false,true);
      }
      }
      So am I totally off-track or is there a way I can replace the tweening cleanly, I've tried motionpaths, animation etc... but nothing seems to work, and the big one is can I have multiple targets in a set of sequences/animations that could rival tweening.
      David

        • 1. Re: Troubles with Sequences
          Chet Haase Level 3

          Hi David,

           

          You should definitely be able to do this. The effects version is actually simpler than what you have below in Flex 4 beta (because of the new RepeatBehavior functionality and the ability for Animate to target multiple properties) (are you on Flex 4? Or using Flex 3?), but the key thing is that you have to specify the target (or multiple targets) either in the effect declaration or in the play() method when you launch it. Assuming you're okay with declaring the targets in the effects, here's how I'd rewrite your code using Flex4 effects:

           

          <s:Animate targets="{[paperMod, bezier]}" repeatCount="2" repeatBehavior="reverse"/>

              <s:SimpleMotionPath property="force" valueFrom="0" valueTo="1.8"/>

              <s:SimpleMotionPath property="angle" valueFrom="-1" valueTo="-.25"/>

              <s:SimpleMotionPath property="force" valueFrom="0" valueTo=".3"/>

          </s:Animate>

           

          If this is a question about Flex 3 effects, then I think the only thing you're missing is the targets. Add 'targets="{[paperMod, bezier]}"' to your Sequence declaration (the targets of composite effects propagate to the children unless the children override the targets).

           

          Does this help?

           

          Chet.

           

          ps: I have various tutorial videos on effects (Flex3 and Flex 4) on my blog at http://graphics-geek.blogspot.com - check it out if you want to get the bigger picture on how this stuff works.

           

           

          <mx:Sequence id="flipper">

          <mx:Parallel duration="500">

          <mx:AnimateProperty property="force" fromValue="0" toValue="1.8"/>

          <mx:AnimateProperty property="angle" fromValue="-1.00" toValue="-

          0.25"/>

          <mx:AnimateProperty property="offset" fromValue="1" toValue="0.3"/>

          </mx:Parallel>

           

          <mx:Parallel duration="750">

          <mx:AnimateProperty property="force" toValue="0" fromValue="1.8"/>

          <mx:AnimateProperty property="angle" toValue="-1.00" fromValue="-

          0.25"/>

          <mx:AnimateProperty property="offset" toValue="1" fromValue="0.3"/>

          </mx:Parallel>

          </mx:Sequence>

          >

          • 2. Re: Troubles with Sequences
            David_F57 Level 5

            There still seems to be an issue with declaring the target within the tag but now all is working well

             

            -the declaration

             

            <mx:Parallel id="flipper" duration="850">     

            <s:Animate id="myflip_a" repeatCount="2" repeatBehavior="reverse" duration="600">

                <s:SimpleMotionPath property="force" valueFrom="0" valueTo="1.8"/>

                <s:SimpleMotionPath property="offset" valueFrom="1" valueTo="0.3"/>

                <s:SimpleMotionPath property="angle" valueFrom="-1.00" valueTo="0.3"/>

            </s:Animate>

            <s:Animate id="myflip_b" startDelay="250">

                <s:SimpleMotionPath property="rotationY" valueFrom="180" valueTo="1"/>

            </s:Animate>     

            </mx:Parallel>

             

            -the call

                      myflip_a.target=paperMod;

                      myflip_b.target=PageL;

                      flipper.play();

            This is so much smoother than tweening. Which was what I have been wanting to do for a while - now to somehow embed a 3d animation inside a flip-book
            Thanks for that, you have saved a wall a monitor and a notebook(although the mouse appears rather bruised), I must owe you a beer or three

            • 3. Re: Troubles with Sequences
              CoreyRLucier Adobe Employee

              are you sure you are using a binding to set the target?

               

              e.g.

               

              <Sequence target="{myTarget}" ... />

               

              Regards,

               

              Corey

              • 4. Re: Troubles with Sequences
                David_F57 Level 5

                <mx:Parallel id="flipper" duration="850">     

                <s:Animate id="myflip_a" target="{paperMod}" repeatCount="2" repeatBehavior="reverse" duration="600">

                    <s:SimpleMotionPath property="force" valueFrom="0" valueTo="1.8"/>

                    <s:SimpleMotionPath property="offset" valueFrom="1" valueTo="0.3"/>

                    <s:SimpleMotionPath property="angle" valueFrom="-1.00" valueTo="0.3"/>

                </s:Animate>

                <s:Animate id="myflip_b" target="{PageL}" startDelay="250">

                    <s:SimpleMotionPath property="rotationY" valueFrom="180" valueTo="1"/>

                </s:Animate>     

                </mx:Parallel>     

                 

                The above code will work

                 

                if I place  targets="{[paperMod,PageL]}" into the parallel or first animate tag or all the tags only the first animate will work, if I don't have a target declared in the first animate tag but do in the second animate tag the first animate still works but not the second one. This behavior holds tru in both parallel and sequence tags.

                 

                Anyway I am extremely happy that its working s as above now.  its 5am and the sun is about to come up so I think I might give it a rest at least until breakfast time