Tuesday, July 22, 2008

The ActionScript 3.0 Documentation is Muck

Imagine, you're relatively new to Flex. You try to create an array of objects. From your Java days, you remember the java.util library contains ArrayList, which fits the bill perfectly. Now, you go to the Flex documentation, mx.collections, expecting to find something similar. The LiveDocs contain nothing, so you try Google, which give the suggestion of using mx.collections.ArrayList.

Hold on, didn't you just read the ActionScript documentation and there was no mention of ArrayList? For fun, you try importing mx.collection.ArrayList, creating an ArrayList, populating it and then print the length of the array.

import mx.collections.ArrayList;
import mx.controls.Alert;

var theList : ArrayList = new ArrayList();
theList.addItem(new Object);
theList.addItem(new Object);
theList.addItem(new Object);

Alert.show(theList.length.toString());

Surprisingly, this compiles and outputs 3 as the expected result, despite the fact there is no documentation to suggest it would work.

3 comments:

gammagoblin said...

Java is for n00bs... manly men use ActionScript. Men programmers don't need no stinkin' docs!

Anonymous said...

Yerra, whats Actionscript? Perl and Javascript have served me well, why change now? :)

Carrigaline said...

ambrand: ActionScript is the programming language behind Flash and Flex.

Athiest Spam Bot

I can't say that I am all that keen on the revamped Blogger.