The effect is defined in a mxml application that I use to test the
component. Here is a code snippet.

   <mx:Button x="573" y="135" label="Higher"
       click="{component1.height = component1.height + increment}"/>
   <mx:Button x="418" y="120" label="&gt;"
       click="{component1.move(component1.x + increment,component1.y)}"/>

   <ns1:mycomp
       id="component1" moveEffect="move1"
       borderStyle="solid" borderThickness="4" y="190" width="674" x="30"/>

   <mx:Move id="move1" duration="500" target="{component1}" />

The reason that I want to check for an effect is that when I move the
component using the move method or set the width the component moves to the
location instantly and then the tween instance snaps the component back to
the start position of the tween and then carries it through as it should. So
there is this flicker of the component going to the final position or size
and then snapping back before the start of the tween. I traced it out and
you can see the first value in the move listener function is the final
desired value. Values after that are syncronized with the move effect.

For example, I added a listener to the move method. The component x
coordinate is 30. I click the button to move the component to 80. Here is
the trace statement in the moveHandler:

   // adding event handler
   addEventListener(MoveEvent.MOVE,moveHandler);
   // move handler
   public function moveHandler(event:MoveEvent):void {
               trace("move to ", x);

// console output
move to  90 <-- notice this first value
move to  30
move to  30.6
move to  32.2
move to  35.050000000000004
move to  38.900000000000006
move to  43.6
move to  48.050000000000004
move to  52.150000000000006
move to  55.45
move to  59.2
move to  63.550000000000004
move to  67.45
move to  71.55
move to  74.75
move to  78.2
move to  81.2
move to  84
move to  85.9
move to  87.80000000000001
move to  89.05000000000001
move to  89.80000000000001
move to  90



On 12/27/06, Alex Harui <[EMAIL PROTECTED]> wrote:

   Where is the move effect defined?  Any effect dispatches events when it
starts and stops (effectStart, effectEnd)


 ------------------------------

*From:* [email protected] [mailto:
[EMAIL PROTECTED] *On Behalf Of *dorkie dork from dorktown
*Sent:* Tuesday, December 26, 2006 4:49 PM
*To:* [email protected]
*Subject:* [flexcomponents]How do I check if an effect is in effect?



How do I check if an effect is in effect?

My component is listening to the move event and runs some code when the
component is moved. But if there is a move effect then I need to handle
things differently.

addEventListener( MoveEvent.MOVE,moveHandler);

public function moveHandler(event:MoveEvent):void {

   if (effectIsRunning) {
     // do something
   }
   else {
     // do something else
   }
}

dorkie in full effect dork from dorktown

Reply via email to