I must develop an application which has several "panel" components. Each "panel" will be different, but will share some basic characteristics with the others(round corners, a linear gradient, two buttons which dispatch events, and so on).
What I thought to do is to develop a base "panel" component and then create all the other components basing them upon this base component.
Once created the base component I attempted to create another component (file->new mxml component) and filled out all the fields. On the "Based on" field I clicked "browse" and then selected the component I created (which resides under components.panel). The wizard completed successfully, but when I enter in the new component , supposed to be based on the other one, nothing of the base component is displayed. I thought was a problem of flash builder, but even if I run the project nothing is displayed
Both the base and derived component are mxml component.
Am I missing something?
I can't using just a skin because I also need the buttons to be present and dispatch events in order to capture them in the child component and handle them differently accordingly to what the component is supposed to do.So I don't need to ineherit just visual appeareance but also functionality
Thanks in advance for the attention.
If you extend an MXML container the elements in the base class will be replaced by the elements in the sub class.
Sounds like you want to consider extending SkinnableComponent or Panel to add some skin parts. This document should be a good starting point: http://www.adobe.com/devnet/flex/articles/flex4_skinning.html
This post demonstrates how to extend TitleWindow to add a skin part (which is very similar to Panel): http://flexponential.com/2010/01/10/resizable-titlewindow-in-flex-4/
Thank you, I'll have a look at it!