Then how would you recommend implementing a button with transitions? Buttons go through transitions (they are simple state machines), but it doesn't appear to me (on admittedly casual inspection) that there's any way to act on those transitions (in a way similar to how effects work).
Sure, you can create a multi-frame animation for a given button state, and you don't even have to do that in Flash, a programmatic skin could do it with programmatic animation. I'm just not clear on how would could correctly and accurately handle transitions. For example, I can happily plan an animation in the up state. And then when the user mouses over my button, my skin switches to an over state, and I can play an animation for that. But is there a way to skin the *transition* from one state to another? I guess you could mirror the button's state machine and handle transitions transparently to the button. With a programmatic skin, you basically (in one style of implementation) have a giant switch statement that determines if the skin is "up", "over", "down", "focus", etc. You'd just need to update this switch to account for "transition states" and animate appropriately. You'd have the awkward scenario of the button entering the the "over" state immediately while the skin was in the "up_to_over" transition state, which may or may not be a problem depending on the complexity of the animation. Is it possible to manually control the states of a button or is it hardcoded to specific events (mouse over, mouse down, etc.)? Troy. On 9/17/07, Alex Harui <[EMAIL PROTECTED]> wrote: > > Contianers are very heavy. There's actually quite a bit of logic making > a button feel like a button. You can approximate it with Canvas and states, > but you might miss some things. It really depends on quality and what > you're comfortable with. If you don't know Flash, it could take you a while > to figure out how to create a symbol. > > > ------------------------------ > > *From:* [email protected] [mailto:[EMAIL PROTECTED] *On > Behalf Of *Troy Gilbert > *Sent:* Monday, September 17, 2007 11:15 AM > *To:* [email protected] > *Subject:* Re: [flexcoders] Buttons in Flex ! > > > > One option would be to use the effects of the button to do the > transitions. Unfortunately, they don't appear to be customized for the > Button class, so I don't know if you'd step on stuff the Button class does > in regards to mouseOver, mouseOut, etc. > > To be honest, depending on the complexity of your visuals and the number > of these buttons you need in your UI, it may be quicker to just create an > mx:Canvas that looks like a button and use effects (if you need a container > with children, e.g. labels and images), or just create a UIComponent > directly and manipulate it (if you've got just images). > > Of course, that does depend on the overhead of Canvas which is something > I've been curious about (and perhaps Alex could answer): does mx:Canvas > introduce much overhead to the UI (as compared to UIComponent)? I know > mx:Canvas does a lot of layout chores, but are they relatively cheap if the > children are relatively cheap ( e.g. a few fixed sized components with > fixed positions)? > > Troy. > > On 9/17/07, *Alex Harui* <[EMAIL PROTECTED] > wrote: > > You can design a skin as a multi-frame animation in Flash and use it in > Flex > > > ------------------------------ > > *From:* [email protected] [mailto: [EMAIL PROTECTED] *On > Behalf Of *Troy Gilbert > *Sent:* Monday, September 17, 2007 10:38 AM > *To:* [email protected] > *Subject:* Re: [flexcoders] Buttons in Flex ! > > > > > I am creating some skins for my buttons, but i have one problem. I want > > to have a nice transition from one skin (Up Skin) to another skin (Down > > skin). In other words i want to create a button that lights when i do > > mouseOver but slowly. IS that possible? > > Hmm, good question... > > In the Flash IDE, you'd just create animations in each state > (transition is tricky, but you could easily have it play an animation > at the beginning of a state and loop). > > In Flex, you could do it with a programmatic skin, but you'd be > responsible for juggling all the animation and state information. > Again, transitions would be difficult, i.e. Up to Down plays this > animation, but Up to Over plays this animation (or whatever > transitions make sense). > > If you wanted to keep things as "high level" as possible, by which I > mean doing it declaratively in MXML, you'd probably end up just > skipping a subclass of mx:Button and instead subclass mx:Canvas and > use effects/behaviors. > > Troy. > > > > >

