The button itself doesn't use its own states to move between the up/over/down/disabled button states. Instead, you need to create a skin class that defines these states. I've coded up a very basic example that includes transitions.
Enjoy, Jason ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of restlessdesign Sent: Friday, September 21, 2007 9:13 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Buttons in Flex ! Hmmm...not as easy as expected. Anyone have any ideas (MXML or Actionscript)? <mx:Button id="myButton" x="10" y="10" label="Squirrels!" styleName="customBtn"> <mx:transitions> <mx:Transition fromState="*" toState="*"> <mx:Fade alphaFrom="0" alphaTo="100" duration="20000" /> </mx:Transition> </mx:transitions> </mx:Button> Stylesheet: .customBtn { upSkin: Embed(source='../assets/defaultButton_up.png', scaleGridTop='6', scaleGridBottom='10', scaleGridLeft='40', scaleGridRight='80'); overSkin: Embed(source='../assets/defaultButton_over.png', scaleGridTop='6', scaleGridBottom='10', scaleGridLeft='40', scaleGridRight='80'); downSkin: Embed(source='../assets/defaultButton_down.png', scaleGridTop='6', scaleGridBottom='10', scaleGridLeft='40', scaleGridRight='80'); } Thanks! --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > In theory you can do this in Moxie, but in 2.x, all you are seeing is an > inherited prop that Button does not use. > > > > ________________________________ > > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of restlessdesign > Sent: Monday, September 17, 2007 11:10 AM > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Re: Buttons in Flex ! > > > > I too have this issue and did some quick research. Would it be > possible to use the transitions property of the Button class and pass > in effects that way using its pre-defined states (upState, overState, > downState, etc.)? >
stateSkin.mxml
Description: stateSkin.mxml
buttonWithStateSkin.mxml
Description: buttonWithStateSkin.mxml
<<attachment: upSkin.jpg>>
<<attachment: disabledSkin.jpg>>
<<attachment: downSkin.jpg>>
<<attachment: overSkin.jpg>>