Archive for 'Flash ActionScript'

Using custom AS2.0 classes with MovieClips that contain Components

When creating a movie clip with an associated AS 2.0 class (using the Linkage dialog for the symbol), any components on that movie clip cannot be accessed in the constructor of the class. References to the component instances will be non-null, but they’ll appear as plain movieclip instances and not have any of the methods or fields from their component classes.

CellRenderer setValue behavior

The “selected” parameter of the CellRenderer’s setValue() method behaves differently from how it is documented.

Access to enclosing class members in anonymous inner classes

The AS2 analogue of Java’s anonymous inner class construct is common for event handlers and looks like this: class Bar { var notifier; public function foo(Void):Void { var loadListener = new Object(); loadListener.numLoaded = 0; loadListener.handleEvent = function(evt) { if (evt.type == “complete”) { trace(“all done”); notifier.notify(); // < — won’t work } }; myLoader.addEventListener(“progress”, [...]

Parsing numeric input from a String field

Be careful when parsing numeric entries from a text field or similar component in which the user is supposed to enter a numeric value as a string.