Thursday, June 19, 2008

MXML

Basic MXML syntax

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.

ActionScript 3.0 uses syntax based on the ECMAScript edition 4 draft language specification. ActionScript 3.0 includes the following features:

  • 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

For more information about ActionScript 3.0, see Using ActionScript.

Naming MXML files

MXML filenames must adhere to the following naming conventions:

  • 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.
  • 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.
  • Filenames must end with a lowercase .mxml file extension.

Using tags that represent ActionScript classes

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.

No comments:

Topics