ActionScript MXML <mx:> vs <s:>

≡放荡痞女 提交于 2019-12-20 02:34:27

问题


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

So, which has more advantages?


回答1:


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.




回答2:


<mx> is the old, slowly being depreciated namespace. All new projects should use <s> whenever possible as with future releases all components will be moved under <s> (Spark) as they are upgraded.




回答3:


The spark namespace is new to Flex 4, they are basically a new version or the namespace components, and I think the main goal of sparl components is to be easy to skin and such.

You can read more about them http://www.adobe.com/devnet/flex/articles/flex4_sparkintro_02.html



来源:https://stackoverflow.com/questions/3477736/actionscript-mxml-mx-vs-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!