What's the difference between the mx/fx/s object types in Flex 4?

5.8k views Asked by At

Flex4 provides the following namespaces:

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

What's the difference? Which namespace provide which function? Where can I find info about that?

1

There are 1 answers

0
user236239 On BEST ANSWER

Namespaces allow you to specify to the compiler where to look for the files/classes that you reference in your mxml.

There are two different types of namespaces that get used in Flex 4. A language namespace and a component namespace. the http: //ns.adobe.com/mxml/2009 namespace specifies what version of the mxml language gets used. This includes things like the script tag and binding tag as well as new tags like declarations and private.

The other 2 namespaces you reference above are component namespaces. These are references to the specific ActionScript classes that make up the UI components you will use in your application. The /flex/spark component set is the new flex 4 components which have skins and component implementation seperate. The /flex/halo set are the components that exist in the flex 3 set. Be careful though the /flex/halo has been renamed /flex/mx in new nightly builds.

In Flex 3 there was only one language available and only one component set so they jammed the definitions for those together in one file. So while the technical bits under the hood have not changed, the way adobe exposes them (through multiple namespaces) has. This may seem more complicated at first, but keep in mind that in doing flex work you have always created xml namespaces for all your view components in mxml. So now you play on the same level as the core framework, which is great. Also in Flex 4 there are several languages and component sets that can be used, so it would be impossible to create that one-to-one mapping that existed in Flex 3.

For more information on this topic please refer to the Adobe docs on the subject: http://opensource.adobe.com/wiki/display/flexsdk/MXML+2009

HTH,

sim