By Fumio Nonaka
 
Created
4 October 2010
 

Requirements

 
Prerequisite knowledge

Some prior experience working with ActionScript 3 is recommended. Familiarity with the Flash authoring environment is also helpful.
 

 
User level

Beginning
 
This article is the fourth of seven in a series highlighting examples of programming strategies that make it easier than ever before to create rich content in Adobe Flash CS5 Professional. Adobe Flash Player 10 includes many improvements for ActionScript. One notable change is the way it implements the Vector class, which could now be called an optimized and typed Array.
 
In the past, it wasn't possible to use the Vector() constructor method to specify its elements like an Array. However, using the new syntax, you can now drill down to the desired element, like this:
 
new <base type>[element0, element1, ..., elementN, ]
In the new syntax, the name of the class, (Vector) and the parentheses are not typed. Additionally, although it is rather unusual, the comma after the last element can be omitted.
 
For example, you can type the following statement to create a Vector instance containing three sequential integer elements, 0 to 2:
 
var myVector:Vector.<int> = new <int>[0, 1, 2];
Keep in mind that this syntax cannot specify the fixed length of an instance. To do that, use the Vector.fixed property to set the length in another statement.
 
To learn more about working with the Vector class and to find out more about how it compares with the Array class, see Mike Chambers's blog posts titled Using Vectors in ActionScript 3 and Flash Player 10 and ActionScript 3 Vector / Array Performance Comparison.
 

 
Where to go from here

As you can see from these examples, there are many new possibilities to explore when developing ActionScript 3 projects in Flash Professional CS5. Hopefully the scripts provided in these examples will serve as the starting point as you begin experimenting with the new events and capabilities for delivering rich content with interactivity.
 
Be sure to check out my other articles in this series:
 
To learn more about developing with ActionScript 3, see the following online resources:
 
Also be sure to visit the Flash Developer Center to find more articles and sample files to help you take your Flash projects to the next level.