Lazy Number manipulation (such as decimal places or precision)

If you want to manipulate a Number Object (variable) to a specific precision or to fixed decimal places, instead of manipulating the Number itself you can use the Number Class conversion Methods such as toFixed and toPrecision and cast the String Objects they return back to Number Objects:

pi = Number(Math.PI.toFixed(2));
trace(pi); // 3.14

Not a replacement for a dedicated rounding function for mathematical formulae, but a handy shortcut to output rounded Numbers in a DataProvider for example.

Variable assignment by value rather than by reference in ActionScript 3 for Arrays

Something that has bugged me a few times, but I needed to figure out this time, as a Flash beginner, is that because everything is an object (and thus an instance of a class, including primatives) you more often than not (unless using primitives/statics) bind everything because you’re always passing variables by reference.

Expecting leftParen before something where there is nothing?

An ActionScript Compiler bug that I discovered today (that has been open for 5 years according to Adobe!;jsessionid=0DF58E72CC5A07E2AF4CAC97C7A22005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel) whereby a compliation error caused in one timeline script will cascade to another without an appropriate warning as to where it was generated.

Call to a possibly undefined method addFrameScript

I decided that I should start posting some of the little niggles that I come across everyday, and the solutions that I’ve found, so that other people can find them somewhat easier than I may have (although that means years of PHP problems have been lost in the mists of time!)

addFrameScript is an undocumented method (does not appear in the ActionScript Language Reference) that allows you to *something *something as explained well at troyworks, AS3: MovieClip.addFrameScript