What is the best practice to develop a visual component in Flex Hero?I do it like this:I consider a component has 2 parts, the declarative part (the visual sub-components) which I define in the skin (just mxml) and the code part (event handlers...) which I define in an action script class. I load the skin in the ctor of the action script class. I also define skin parts, states, and I bind event handlers in the partAdded function.I am having an argument about this; that I should define the component purely in an .mxml, with listeners in the script tag, and maybe attach a skin (but the skin should be loose - maybe for reuse :-?)I come from .NET and maybe I am biased with the code behind pattern, and I am wondering from your experience and Adobe's intent, what is the best practice to usually implement a visual component?
What is the best practice to develop a visual component in Flex Hero?
mvc;flex
There are 3 ways to implement components.1 pure ActionScriptExtend UIComponent.2 MXMLMXML is just an abstraction of ActionScript. When compiling a Flex application, the source code will translate MXML to ActionScript. So, there is basically nothing wrong to have ActionScript in the fx:Script tag. There are some people who say, that a view should contain no logic (when implemented in MXML) but that is plain stupid, since you need ActionScript to define behavior.3 SkinnableComponent (separation of behavior and visual appearance)You extend SkinnableComponent and define a skin class. This is extremely helpful, when theming for different clients or load different visual appearances depending on a user's role.The code behind aprouch can be achieved easily in ActionScript, wether be aggregation or inheritance. Also an MVVM can be implemented easily. But generally, that's not the pattern you use. Usually in Flex, you use MVC/MVCS.You may want to take a look: Flash builder 4.6 - code behind approach