Bump. I'm wondering if anyone can comment on this. I still don't have a ton of experience with Flex 4 skins, so I'm wondering how to approach this task.
1 person found this helpful
Interesting...hmmm... I did a little playing with it.
The base skin for SkinnableContainer (when you start with the createSkin), only includes a normal and disabled state. So, I wondered if the skinnableContainer would even detect the rollOver? It did not. That is why the color wasn't changing.
So, I added my own eventListener for MouseOver and it works fine.
protected function skin1_creationCompleteHandler(event:FlexEvent):void
protected function onMouseOver(event:MouseEvent):void
Apparently, only the default states for each component type work, any other states you add, you need to listen for them yourself.
Hope this helps.
Maybe that's it. Thanks for the reply.
But it seems strange, because I'm trying to exercise control over the visual appearance of a component in its skin, which it supposed to be the Flex 4/4.5 way, and yet I have to create event listeners in the skin to do it? It seems weird.
The new state model supposedly provides the ability to do things like color.rollOver and color.rollOut, not not in skins? But inside skins is where we're supposed to manage the visual appearance. Doesn't make sense.
Maybe Alex Harui and/or others on the Adobe team can chime in on this.
The Spark Button is a perfect example of what you are trying to do. The mouse listeners are added/handled in the Button component itself and the Button communicates it current state (up, over, down, etc.) to the skin through the "getCurrentSkinState" method.
Bingo! That sounds like the answer I was looking for. Thanks!