What does different namespaces mean in Flex?

笑着哭i 提交于 2019-12-23 23:13:10

问题


I worked on a flex application 6-7 months back. We used flex 3.5 sdk. Now we are upgrading our flex app with flex sdk 4/4.1

I am still new to flex development and I have a very basic question related to namespace.

I have seen three different namespaces in flex sample applications. What is the purpose of having three diff namespaces? When do I use each of them ?

xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx"

Thanks


回答1:


Namespaces are a way of logically grouping code together. Here's some more on that from Adobe.

In your particular example, these are XML Namespaces.

The particular namespaces listed above are listed as they are being used by your Flex application for:

fx - Contains the top-level ActionScript Language elements.

s - Include the Flex Spark components

mx - Contains all the components in the Flex mx.* packages, flex charting & data visualization components.

For more info on these particular namespaces and using XML namespaces in general: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf5f39f-7ff7.html#WS2db454920e96a9e51e63e3d11c0bf5f39f-7ff3




回答2:


Also found out this document that explains upgrading flex app from sdk 3 to sdk 4. This pdf contains explanation of namespaces. http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/flex/pdfs/upgrading-flex3-to-flex4-techguide.pdf




回答3:


The mx namespace is the original namespace for Flex components. The s namespace points to the newer Spark components, many of which have the same class names (s:Application vs. mx:Application for example). I haven't used the fx namespace yet, but I'm fairly certain it is used for effect and transition declarations, which are done differently than mx effects. Hope that helps.



来源:https://stackoverflow.com/questions/6038235/what-does-different-namespaces-mean-in-flex

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