It's a fact that ActionScript does not support typed arrays. It means that you can't specify the data type of the elements of the Array. Flex SDK provides the [ArrayElementType] meta tag that allows you to specify Array type checking using Flex Builder and the Flex compiler:
[ArrayElementType("int")] private var _intArray:Array;
[ArrayElementType("String")] private var _stringArray:Array;
In the above example I've specified the data type for the Array elements. In the first Array,_intArray , the elements of the Array must be int, while in the second Array, _stringArray, the elements of the Array must be String. If you try to put different data types into the Array the Flex compiler will issue a syntax error. Cool and simple.
But you can also use the [ArrayElementType] to specify an ActionScript Value Object (it's an ActionScript class) as data type of the elements of the Array. In this scenario you pass the fully qualified package reference of the ActionScript Value Object as type of the ArrayElementType:
[ArrayElementType("com.casario.vo.UserVO")]
protected var _users:Array;
Then you can populate the _users property using, for istance, the push method:
_users.push( new com.casario.vo.UserVO ( id, name, role, description ) );
The ActionScript Value Object should look like this:
package com.casario.vo
{
[Bindable]
public class UserVO
{
public var id:String;
public var name:String;
public var role:String;
public var description:String;
public function UserVO(
id:String,
name:String,
role:String,
description:String,
)
{
this.id = id;
this.name = name;
this.role = role;
this.description = description;
}
}
}
Forcing the value object as data type you'll get compile-time errors if you'll attempt to assign elements of a data type other than the UserVO ActionScript Value Object to the Array in an MXML file.



















Feed for your entire site: you have been inspiring to me with the post and all!
http://iolani.hubpages.com/hub/ged-practice-test
Ged Practice Test
http://www.squidoo.com/ged-practice-test-preparation
Posted by: Salary Nurse | April 11, 2012 at 08:43 AM
Commenting on this site is a pleasure for me. I had really liked reading this site it was very good. The content of this blog was very nice.
http://www.cna-salary.com/cna-salary-indiana/
http://www.cna-salary.com/cna-salary-nevada/
Posted by: OnlineCNAClass | July 30, 2011 at 01:13 PM
Offer good for new subscribers only. Offer good in U.S. only. Overseas subscribers please click here. Newsstand price is $5.95 per issue. Please allow 6 to 8 weeks for mailing of first issue. Subscribers: If the Post Office alerts us that your magazine is undeliverable, we have no further obligation unless we receive a corrected address within two years.
Ode Privacy Policy.
Posted by: Online CNA Classes | April 26, 2011 at 01:24 PM