2 Replies Latest reply on Feb 18, 2010 10:05 AM by nikos101

    Event when effect had reached its half way point?

    nikos101 Level 2

      How would I clear the text of my richText when the effect had reached its half way point?

       

          <s:Parallel id="rotateZoomOUT"
                          >
                  <s:Rotate3D angleYFrom="0" angleYTo="-90"
                              repeatBehavior="{RepeatBehavior.REVERSE}"
                              repeatCount="2" duration="800"
                              effectEnd="effectEndHandler(event)"/>
                  <s:Move3D
                            zBy="1000" repeatCount="2" duration="800"
                            repeatBehavior="{RepeatBehavior.REVERSE}"
                            autoCenterTransform="false"
                            effectEnd="effectEndHandler(event)"
                           
                            />
              </s:Parallel>

        • 1. Re: Event when effect had reached its half way point?
          Chet Haase Level 3

          There are various ways to do this, although there is no way to listen specifically for a point in time (other than the start, end, or repeat points).

           

          For example:

          - you could listen for the effectRepeat event on either the Rotate3D or Move3D; this will be sent when the effect reaches the end and is about to reverse. I think that's probably what you're looking for here, so that'd work

          - you could break up your effects into separate effects that did half the job, then listen for the effectEnd event of the first half and do the operation then

          - you could listen for the effectUpdate event and figure out how much time has elapsed on the animation and do the operation when you pass half way

          - you could add a Pause effect to run in parallel for half of the time and listen for the effectEnd on that effect and do the action at that time

          - you could add a SetAction or CallAction effect to run in parallel with a startDelay that's half of the total duration

          - ....

           

          Couple of things I noticed in the effect code below. Maybe these are just copy/paste errors and the actual code in your app works, but:

          - you don't have a target specified for any of these effects. No target, no animation.

          - if you want effects to auto-center the transform, specific autoCenterTransform="true" for all of them. The effects are combined internally and take the value of that property from the first effect that's processed, so if you just set that property on the last effect (as in the code below) then you won't actually get auto-centering. Best practice is  to just put it on all of the transform effects to make sure you're getting what you want.

           

          Chet.

          • 2. Re: Event when effect had reached its half way point?
            nikos101 Level 2

            Perfect thanks

             

             

            <s:Parallel id="rotateZoomOUT"
                                >
                        <s:Rotate3D angleYFrom="0" angleYTo="-90"
                                    repeatBehavior="{RepeatBehavior.REVERSE}"
                                    repeatCount="2" duration="800" autoCenterTransform="true"
                                    effectEnd="effectEndHandler(event)">
                            <s:effectRepeat>
                                <![CDATA[
                                customEditor.editor.textFlow = new TextFlow();   
                                ]]>
                            </s:effectRepeat>

                        </s:Rotate3D>
                        <s:Move3D
                                  zBy="1000" repeatCount="2" duration="800"
                                  repeatBehavior="{RepeatBehavior.REVERSE}"
                                   autoCenterTransform="true"
                                  effectEnd="effectEndHandler(event)"
                                 
                                  />
                    </s:Parallel>