Try using the mx.effects.Sequence.  If you don't want to use any of the Flex 
classes, then build a queue, and when the effect has completed, run the next 
effect in the array.

----- Original Message ----- 
From: "quasimotoca" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Wednesday, February 22, 2006 10:08 PM
Subject: [flexcoders] Animation Sequence Problem.


I am writing a simple animation program which uses the flash
effects.Move component. My problem is as follows:

1. I repeatedly call a function that adds bitmaps in UIComponent
objects to a canvas and then applies a move effect to it.

public function setUICard(x:Number, y:Number):UIComponent
{
var c:UIComponent = new UIComponent()
var s:Bitmap

s = Bitmap(new cardPicture())

c.addChild(s)
c.move(390, 105)
canvas.addChild(c)

var mvArray:Array = new Array()
mvArray.push(c)

var mvEffects:Move = new Move()
mvEffects.xFrom = 390
mvEffects.yFrom = 105
mvEffects.xTo = x
mvEffects.yTo = y
mvEffects.duration = 2000
mvEffects.play(mvArray)

return c
}

2. The problem with the above code is that the effects (animations)
run in parallel. But what I would like to happen is for the
animations to run sequentially. With a view to this I tried:

public function setUICard(x:Number, y:Number):UIComponent
{
var c:UIComponent = new UIComponent()
var s:Bitmap

s = Bitmap(new cardPicture())

c.addChild(s)
c.move(390, 105)
canvas.addChild(c)

var mvArray:Array = new Array()
mvArray.push(c)

var mvEffects:Move = new Move()
mvEffects.xFrom = 390
mvEffects.yFrom = 105
mvEffects.xTo = x
mvEffects.yTo = y
mvEffects.duration = 2000
mvEffects.play(mvArray)

// New Code

while (mvEffects.isPlaying)
{

// Yield Execution

}

return c
}

3. The problem with the above is that it locks the whole program up.
What I would like to do is to have the program yield control inside
the loop, so that the current animation would continue (something
like the DoEvents function in Visual Basic) while the function itself
would pause.

Cheers,

Dave






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to