User Guide
Basic MXML syntax 37
Arrays of scalar values
When a class has a property that takes an Array as its value, you can represent the property in
MXML using child tags. The component in the following example has a
dataProvider property
that contains an Array of numbers:
<mx:List>
<mx:dataProvider>
<mx:Array>
<mx:Number>94062</mx:Number>
<mx:Number>14850</mx:Number>
<mx:Number>53402</mx:Number>
</mx:Array>
</mx:dataProvider>
</mx:List>
Objects
When a component has a property that takes an object as its value, you can represent the property
in MXML using child tags, as the following example shows:
<mynamespace:MyComponent>
<mynamespace:nameOfProperty>
<objectType prop1="val1" prop2="val2"/>
</mynamespace:nameOfProperty>
</mynamespace:MyComponent>
The following example shows an ActionScript class that defines an Address object. This object is
used as a property of the PurchaseOrder component in the next example.
class example.Address
{
var name : String;
var street : String;
var city: String;
var state: String;
var zip: Number;
}
The following example shows an ActionScript class that defines a PurchaseOrder component that
has a property type of Address:
import example.Address;
class example.PurchaseOrder {
public var shippingAddress : Address;
public var quantity : Number;
...
}
In MXML, you define the PurchaseOrder component as the following example shows:
<e:PurchaseOrder quantity="3" xmlns:e="example">
<e:shippingAddress>
<e:Address name="Fred" street="123 Elm St."/>
</e:shippingAddress>
</e:PurchaseOrder>