actionscript-3apache-flexmxmlflex-mxflex-spark

ActionScript MXML <mx:> vs <s:>


Looks like I can use components for both <mx:> or <s:>.

So, which has more advantages?


Solution

  • As other posters have mentioned, the spark (s:) namespace refers to the new components introduced with Flex 4, while the halo/mx (mx:) namespace refers to the older components.

    They can be used together, which is necessary since there are not spark equivalents for all of the mx components (notable omissions are DataGrid, Tree, DividedBox, among others.) Some of the motivations for the new spark components include: Separation of form from function, which means the spark components are very much skin driven. Lighter weight for performance gains (You can use s:Group for laying out your components rather than mx:Canvas, which is much more efficient since s:Group doesn't have any visual characteristics like fill or border.)

    Bottom line: I find the spark components to be very efficient performance-wise but a little fussy for changing appearance/behavior since you need to create custom skins for them. Also, they have a few quirks that still need to be ironed out (why don't DropDownLists automatically determine their width based on content like the mx versions did?!) Since the halo/mx components are on the path to deprecation, it's generally good practice to use the spark components whenever you can.