I did something similar to implement a Mac OS X style "invalid login shake" on a login panel:
 
function badLogin()
{
   var seq : mx.effects.Sequence = new mx.effects.Sequence(this.loginPanel);
 
   var shakeLeft : mx.effects.Move = new mx.effects.Move(this.loginPanel);
   shakeLeft.xBy = -10;
   shakeLeft.duration = 50;
   
   var shakeRight : mx.effects.Move = new mx.effects.Move(this.loginPanel);
   shakeRight.xBy = 10;
   shakeRight.duration = 50;
   
   seq.addChild(shakeLeft);
   seq.addChild(shakeRight);
   seq.addChild(shakeLeft);
   seq.addChild(shakeRight);
   seq.addChild(shakeLeft);
   seq.addChild(shakeRight);
   
   seq.playEffect();
}
 
In the code, this.loginPanel is the thing you want to move.  Hopefully you can adapt that to your circumstances.
 
Blake
 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin
Sent: Wednesday, October 26, 2005 8:55 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] set Effect at runtime

Try this?

 

Application.application.canvas1.viewstack1.panel1.viewstack2.selectedChild.setStyle(“moveEffect”, “b”);

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of keishichi2001
Sent: Wednesday, October 26, 2005 3:35 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] set Effect at runtime

 

My Flex application is based on Cairngorm 0.99.
Main application includes several custom components and those have
own ViewHelper to render themselves.

Let's assume two of custom components, CompA and CompB.
CompA has a <mx:Image> in it, and it has moveEffect setting.
CompA also has definition of several <mx:Effect>.
ie)
<mx:Effect name="a" ... />
<mx:Effect name="b" ... />

I'd like to change this effect to another one from a ViewHelper of
CompB.
To accomplish this, I tried following code.

=====
...
var curImage:mx.controls.Image =
mx.core.Application.application.canvas1.viewstack1.panel1.viewstack2.s
electedChild.childDescriptors[0];  // Image object

curImage["moveEffect"] = "b";
...
=====

It seems that the moveEffect isn't changed, and no error at runtime.

Am I wrong on my code?
Does anyone have good solution for this issue?


Thanks,
Keishichi









--
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




Reply via email to