Performance improvement to ActionScript 3.0

While reading Sean Moore’s blog post on performance improvements to ActionScript 3.0, I decided to chime in on another one that has drastic performance improvements:

In AdWonder, we use SharedObjects to persist local data (settings, local ads, etc..). So when it came time to start optimizing the latest version (9.4) for performance ( a major theme of this release.. faster, easier, smarter ), we noticed that opening the SharedObjects had the biggest drag on performance! Almost 100ms for each instance (this adds up as you can imagine). So, all of you ActionScripters out there, if there’s a SharedObject you are storing data in, open it once, and store the SharedObject instance somewhere to reuse it. You and your users will love you!

ActionScript 3.0: Events for Static Classes

Normally, a static class in ActionScript 3.0 can’t dispatch events, since you can’t inherit from EventDispatcher or implement IEventDispatcher if the functions are a static.
However, with ActionScript 3.0, you can create an EventDispatcher object to do the dispatching for you!

package {
import flash.events.EventDispatcher;
public class StaticEventDispatcher {
public static var eventEngine:EventDispatcher;
public static function initialize():void
{
eventEngine = new EventDispatcher();
}
}
}