2008-04-30
用MXML开发Flex应用- Basic MXML syntax
Basic MXML syntax
MXML基本语法
Most MXML tags correspond to ActionScript 3.0 classes or properties of classes. Flex parses MXML tags and compiles a SWF file that contains the corresponding ActionScript objects.
许多MXML标签其实就是ActionScript3.0的类或类的属性。Flex解析MXML标签并编译成一个包含ActionScript对象的SWF文件。
ActionScript 3.0 uses syntax based on the ECMAScript edition 4 draft language specification. ActionScript 3.0 includes the following features:
ActionScript3.0语法基于ECMActionScript edtion 4 草稿说明。
- Formal class definition syntax
- Formal packages structure
- Typing of variables, parameters, and return values (compile-time only)
- Implicit getters and setters that use the get and set keywords
- Inheritance
- Public and private members
- Static members
- Cast operator
Naming MXML files
MXML文件命名
MXML filenames must adhere to the following naming conventions:
MXML文件名必须遵守以下规定:
- Filenames must be valid ActionScript identifiers, which means they must start with a letter or underscore character (_), and they can only contain letters, numbers, and underscore characters after that.
- 文件名必须是合法的ActionScript标识符,也就是说,必须以字母或下划线开头,只能包含字符、数字和下划线。
- Filenames must not be the same as ActionScript class names, component id values, or the word application . Do not use filenames that match the names of MXML tags that are in the mx namespace.
- 文件名不能与ActionScript类名,组件id或应用程序名相同。不要用于mx命名空间中的MXML标签名做文件名。
- Filenames must end with a lowercase .mxml file extension.
- 文件名必须以小写.mxml扩展名结束
Using tags that represent ActionScript classes
用标签做ActionScript类
An MXML tag that corresponds to an ActionScript class uses the same naming conventions as the ActionScript class. Class names begin with a capital letter, and capital letters separate the words in class names. For example, when a tag corresponds to an ActionScript class, its properties correspond to the properties and events of that class.
一个MXML标签相对于一个以相同名称命名的ActionScript类。类名以一个大写字母开头,大写字母用来分隔单词。例如,当一个标签相对于一个ActionScript类时,它的属性就相当于那个类的属性或事件方法。


评论