I need some input..
What would be the best (well, recommended) way to implement custom buttons inside Flash Builder?
What I mean by custom buttons, is that I need to show for example a building with 5 floors (in 3d view). The user can then click each of the floor, to update the main view to show the currently selected floor.
In previous examples I’ve simply added one invisible layer below the image, which contains one solid color for each button (each floor). Clicking the image triggers a function that checks what color is selected, and then triggers the action I want.
Are there any better ways of doing this?
Maybe importing an external SWF that communicates with the main app to send the floor-switching commands? (Not that I know how to communicate from an imported external SWF to the main app, only the other way around).
Any input would be great =)
Thanks!
EDIT
After your question, I whipped up something quickly to show that buttons can be of any shape. If you want the floors to be selectable, then you probably want a
ToggleButton, not aButtonso I have re-worked my example a bit and the result is what you describedWhy not use the Flex 4.0 Skinning capability? You get the behavior (and states) of the button component with your own look/feel:
You define your button skin (
FloorButton) with some images:Of course, the path can be replaced with a PNG with transparency to achieve a similar effect.