Flex 命名空间
Flex 通用调试工具(ff,chrome,ie8+)

Flex的MXML文件结构

marz posted @ Aug 12, 2010 09:17:51 PM in flex with tags flex namespace technique , 2564 readers

       下面是一个MXML

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx=http://www.adobe.com/2006/mxml layout="absolute">

   

</mx:Application>

 

第一行声明XML文件采用的语法版本号和文件采用的编码格式。mx:Application标签是一个特殊的标签。在每一个MXML文件,但作为程序入口的运行文件只有一个,主文件的标示是根节点为mx:Application,一个程序中出现一个mx:Application节点。还有一个属性xmlns:mx=http://www.adobe.com/2006/mxml表示将mx定义为XML的命名空间。xmlns标签专门用来定义XML的命名空间,XML命名空间可以用来定义一套独立的XML标签,并且为这些标签指定特殊的解析方式。比如XML文件中默认的标签格式为:<Button>node</Button>,这里的Button节点作为一个普通的文本节点,没有特殊的意义。定义命名空间后,在节点上加上空间前缀:<mx:Button></mx:Button>这时候就代表mx空间下的Button对象。

Mx命名空间对应的路径是”http:// www.adobe.com/2006/mxmlFlex的配置文件中将这个路径定义为一个全局资源标识符,并对应了一个XML文件。在这个文件中,列出了mx命名空间下的所有标签。在Flex SDK3.0.1 目录下的frameworks目录中找到flex-config.xml文件,打开并找到如下内容:

 

<namespaces>

     <namespace>

            <uri>http://www.adobe.com/2006/mxml</uri>

            <manifest>mxml-manifest.xml</manifest>

     </namespace>

</namespaces>

 

从上面可以发现,http://www.adobe.com/2006/mxml”这个URImxml-manifest.xml文件对应,打开该文件,该文件列出了MXML中的所有标签与标签关联的类文件路径。

<?xml version="1.0"?>

 

<componentPackage>

 

   <component id="FileSystemComboBox" class="mx.controls.FileSystemComboBox"/>

<component id="FileSystemDataGrid" class="mx.controls.FileSystemDataGrid"/>

      。。。。。。。

<component id="WebService" class="mx.rpc.soap.mxml.WebService"/>

<component id="WebServiceOperation" class="mx.rpc.soap.mxml.Operation"/>

 

</componentPackage>

 

 

在开发中,当程序有很多MXML文件和AS文件时,为了方便调用,我们可以将功能相似的文件放在一个文件夹中,定义一个命名空间在定义命名空间时,为了方便,很一般直接指定命名空间包括的标签路径。比如:

xmlns:myComp=”components.*”

上面使用了通配符”*” components目录下所有的MXML文件个ActionScript类文件都被包括在myComp命名空间下。例如components中有一个Loginpanel.mxml,则程序中调用这个文件时,代码如下

<myComp: Loginpanel></myComp: Loginpanel>

myComp下的标签被自动指向components文件,当标签数量较多而且分布在不同文件夹时,可以效仿Flex配置文件的做法,使用XML文件来描述。

ref:hi.baidu.com/flexok/blog/item/83397ca93c70dc044a36d61b.html

Bihar Board 10th Soc said:
Sep 28, 2022 02:16:08 AM Leading educational institutions and subject experts of the state provided sample guess paper with practice question bank in chapter wise important questions and answer solutions through newspapers and model sets, Bihar Board 10th Social Model Paper we have recommended to every student can download expert questions of Bihar Board 10th Model Paper 2023 for Social Science to practice regular mock test.Leading educational institutions and subject experts of the state provided sample guess paper with practice question bank in chapter wise important questions and answer solutions through newspapers and model sets.
hkseo said:
Sep 23, 2023 05:29:18 PM

Pretty good post. I have just stumbled upon your blog and enjoyed reading your blog posts very much. I am looking for new posts to get more precious info. Big thanks for the useful info. Delaware startup package

boardmodelpaper.com said:
Jan 12, 2024 01:39:12 AM

Board Model Papers 2024 Download with Suggestions for 10th Class Textbooks 2024 Pdf Download and SSLC New Syllabus Sample Question Paper 2024 and different types of model papers boardmodelpaper.com and question papers for following the website and Arts, Science, Commerce Stream Subject Wise Solved Question Bank for Hindi & English Medium Students with Exam Pattern & Blueprint and subject Wise with 11th & 12th Question Bank 2024 for General & Vocational Course Languages & Subjects Important Question for the above link.


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter