Because MXML files are ordinary XML files, you have a wide choice of development environments. You can write MXML code in a simple text editor, a dedicated XML editor, or an integrated development environment (IDE) that supports text editing. Flex supplies a dedicated IDE, called Adobe(R) Flex(TM) Builder(TM), that you can use to develop your applications.
由于MXML文件是普通的XML文件,您可以选择多种开发环境。你可以在一个简单的文本编辑器中编写MXML代码,专门的XML编辑器,或者一个能支持文本编辑的集成开发环境(IDE)。Flex提供了一个专门的IDE工具,叫做Adobe(R) Flex(TM) Builder(TM),您可以使用它来开发您的程序。
The following example shows a simple “Hello World” application that contains just an <mx:Application> tag and two child tags, the <mx:Panel> tag and the <mx:Label> tag. The <mx:Application> tag defines the Application container that is always the root tag of a Flex application. The <mx:Panel> tag defines a Panel container that includes a title bar, a title, a status message, a border, and a content area for its children. The <mx:Label> tag represents a Label control, a very simple user interface component that displays text.
以下展示的一个简单的“Hello World”程序,只包含了一个<mx:Application>标签和两个子标签,分别是<mx:Panel>和<mx:Label>。<mx:Application>定义了一个程序的容器,它总是作为Flex程序的根标签。<mx:Panel>标签定义了一个面板容器,其中包括标题栏,标题,状态信息,边界,还有一个可以装子节点的内容部分。<mx:Label>标签代表一个Label控件,一个非常简单的UI组件,用于显示文本。
<?xml version="1.0"?>
<!-- mxml\HellowWorld.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Panel title="My Application"
paddingTop="10"
paddingBottom="10"
paddingLeft="10"
paddingRight="10"
>
<mx:Label text="Hello World!" fontWeight="bold" fontSize="24"/>
</mx:Panel>
</mx:Application>
Save this code to a file named hello.mxml. MXML filenames must end in a lowercase .mxml file extension.
将此代码保存为文件hello.mxml。MXML文件名必须以小写的.MXML扩展名结尾。
The following image shows the “Hello World” application rendered in a web browser window:
下面的图片展示了“Hello World”程序在浏览器执行后的效果:
关于XML文件的编写
The first line of the document specifies an optional declaration of the XML version. It is good practice to include encoding information that specifies how the MXML file is encoded. Many editors let you select from a range of file encoding options. On North American operating systems, ISO-8859-1 is the dominant encoding format, and most programs use that format by default. You can use the UTF-8 encoding format to ensure maximum platform compatibility. UTF-8 provides a unique number for every character in a file, and it is platform-, program-, and language-independent.
文件的第一行指定一个可选的XML版本声明。它包括编码信息,指定如何MXML文件进行编码。这是很好的做法。许多编辑器让你在文件开头就指定文件编码选项。在北美的操作系统中,ISO-8859-1是主要的编码格式,并且是大多数程序使用的默认格式。您可以使用UTF-8编码格式,以确保最大的平台兼容性。 UTF-8的提供了一个文件中的每个字符唯一的编号,是平台,项目和语言无关性的。
If you specify an encoding format, it must match the file encoding you use. The following example shows an XML declaration tag that specifies the UTF-8 encoding format:
如果您指定了编码格式,您的文件使用必须符合文件编码的文字。下面的例子显示了一个XML声明标签,指定为UTF-8编码格式:
<?xml version="1.0" encoding="utf-8"?>
关于<mx:Application>标签
In addition to being the root tag of a Flex application, the <mx:Application> tag represents an Application container. A container is a user-interface component that contains other components and has built-in layout rules for positioning its child components. By default, an Application container lays out its children vertically from top to bottom. You can nest other types of containers inside an Application container, such as the Panel container shown above, to position user interface components according to other rules. For more information, see “Using Flex Visual Components” on page 113.
<mx:Application>标签除了作为一个Flex应用程序的根标签,还代表了一个应用程序容器。容器是一个UI组件,其中包含其他组件,并拥有内置的布局规则定位其子组件。默认情况下,一个应用程序容器,将其子组件按照垂直方向从上到下的方式布局。在应用程序中也可以嵌套其他类型的容器内,如上面所述的面板容器,用来定位UI组件按照它自己的规则。更多有关信息,请参阅113页“使用Flex可视组件“。
About MXML tag properties
关于MXML标签的属性
The properties of an MXML tag, such as the text, fontWeight, and fontSize properties of the <mx:Label> tag, let you declaratively configure the initial state of the component. You can use ActionScript code in an <mx:Script> tag to change the state of a component at run time. For more information, see “Using ActionScript” on page 37.
一个MXML标签的属性,是让你声明和配置组件的初始状态。如<mx:Label>标记中的fontWeight和fontSize属性。您也可以在<mx:Script>标签中使用ActionScript代码来
更改在运行时组件的状态。更多有关信息,请参阅第37页“使用ActionScript”。
分享到:
相关推荐
OpenGL入门学习之一——编写第一个OpenGL程序.pdf 系列教程
本文可为初学面向对象的读者提供面向对象程序设计实验——编写Rational类的代码样例,代码完整清晰,建议先通过查看本人博客理清思路,自己编写然后看示例检查,有利于学习
完成一个记事本程序的编写,以下是要求: 1、完成图像界面的设计。 2、完成读取、保存文件功能的设计。 3、完成菜单的设计。 4、能够实现文件对话框的使用。 根据完成的情况,酌情打分。答案可以提交内容为:项目...
如果你想切实体会Android应用开发之道,如果你是一个刚刚入门的Android爱好者,那么这个程序将帮助你分析android程序的精髓。。。
Java--利用TCP编写一个简单的聊天工具(csdn)————程序
编写程序输入年利率k(例如2.52%),存款总额total(例如100000元),计算一年后的本息并输出。
请编写一个文件操作的封装类,其要求如下: 需要提供open/read/write/lseek/close等函数的封装函数 该类要提供数据缓存服务。 调用该类的写操作接口时,数据要首先写到缓存,然后再根据策略写到文件中。 调用该类的...
编程实现N=2^m,例如N=256点FFT算法 将上述程序扩展为N>=8点程序,点数由用户指定(但须满足2的整数幂)。
轻松学会DSP——第5章C程序编写和编译.ppt
VI小程序——用lab view编写的采用一位移位寄存器的摇晃骰子程序,本程序功能简单,算法并不复杂,希望给学习Lab view的人带去启发。
1、定义一个右线性正规文法,示例如(仅供参考) G[S]:S→aU|bV| U→bV|aQ V→aU|bQ Q→aQ|bQ|e 实验前要考虑清楚用哪种数据结构存储上述文法。 2、构造其有穷确定自动机,如 3、利用有穷确定自动机M=(K,Σ,f, S,...
C#编写的一个高级语言程序——值传递
用python编写一个更好看好用的日志库(csdn)————程序
java程序设计、课程设计——Java编写的雷霆战机小游戏的源码java程序设计、课程设计——Java编写的雷霆战机小游戏的源码java程序设计、课程设计——Java编写的雷霆战机小游戏的源码java程序设计、课程设计——Java...
这是一个聊天室程序,可以实现单聊和群聊。
微信小程序项目实例——体质计算器 体质计算器是一款简单的健康类小程序 用户可以根据自身的身高和体重 选择所测标准(中国、亚洲、国际) 生成自身BMI值和当前身体状况 并给出标准体重和相关疾病的预测
C#编写的一个高级语言程序——值传递2
Python3编写实用脚本程序——12306抢票....Python3编写实用脚本程序——12306抢票.zipPython3编写实用脚本程序——12306抢票.zipPython3编写实用脚本程序——12306抢票.zipvPython3编写实用脚本程序——12306抢票.zip