I’ve talked about var args, the arguments keyword, and even the length of a function that has default arguments, but I’ve never written an article all about default arguments… until today.
Posts Tagged functions
There are actually three ways to call a function in AS3. Can you name all three? Do you know which is fastest? Does the type of function being called matter? Today I’ll tackle these questions and find some surprising facts about the three ways to call a function in AS3.
Both Array and Vector have some methods that allow AS3 programmers to do some functional programming: every, filter, forEach, map, and some. These can lead to flexible and concise code, but at what performance cost? Today I’ll test them to get a handle on just how much speed you’re giving away by using these methods.
While I was working on last week’s article it became apparent that something strange was going on with the arguments keyword in AS3. Last week I showed that even after you’ve changed the parameters of a function, you can still get the original values by indexing into arguments. This implies a copy and a copy implies a slowdown. Read on to see if there really is a slowdown and, if there is, what kind of performance impact there is.
I am often burned by MXMLC: the AS3 compiler. When I am, I find this infuriating and look for the reason why this happened. Today I’ll tip you off about this problem and delve into what it means if you happen to trigger it.
I’ve previously covered ways of implementing in my article on Runnables (aka observers) which showed how to call back about 15 times faster than just using a Function object. There are still more ways to call back though and I didn’t cover them at the time. Today I’ll be adding to Function and Runnables by testing Event and the as3signals library by Robert Penner.
The last three articles have been about utility functions for objects, classes, and display objects. This is the finale in the series and contains some leftover utility functions.
Hot on the heels of my articles about utility functions for objects and classes, today’s article has a set of utility functions for DisplayObjects.
On the heels of last Friday’s article on Utility Functions For Objects, today’s article will show a few utility functions for the Class class. In case you’re not familiar with it, Class represents a class like you would write and is useful main for more dynamic programming where you want to instantiate a class based on a variable (eg. var c:Class) rather than a constant (eg. BitmapData). So how do you get a Class variable? The Flash API provides some ways to go about it and I’ll provide some ways to make that more convenient.
Like most programmers writing non-trivial applications, I’ve piled up a lot of utility functions over the years. Most of them are simple and effective. They are short and get their job done. You or someone you know has probably written these functions, but maybe not in AS3. So today I’m going to share a few utility functions for Objects in AS3.