mike chambers | about

Actionscript

as3corelib Library moved to GitHub

I have just moved the as3corelib library over to GitHub (at the urging of Darron Schall). This should make the project a little easier to manage, and in particular, make it easier for developers to contribute patches, and for me to review and accept …

Source code for PewPew Released

I have finally released the source code for my PewPew game. PewPew is a game I started working on over a year ago to help me understand what optimizations would be required to convert a web based Flash game to run on the iPhone. I had planned to …

New Release of as3corelib Library

I have just posted a new release (.93) of as3corelib. The corelib project is an ActionScript 3 Library that contains a number of classes and utilities for working with ActionScript? 3. You can view a complete list of changes in the change list (items …

Case Study : ActionScript 3 Performance Optimization

Prompted by some of the work from Grant Skinner (in particular his FOTB 2009 session) and Thibault Imbert, I have been doing a lot of research lately into optimizing ActionScript 3 content. Not just how to make it run faster, but how to approach the …

Parsing and displaying BMP files via ActionScript

I don’t have a formal computer science training / education, so I never got the chance to learn about working with low level data structures (bits and bytes). I have wanted to learn this for some time, but had difficulty finding resources for …

Converting from Matrix3D to Matrix in ActionScript 3

For the past month or two, I have been spending time building a game (something I haven’t done since my Flash 4 days). This has really been a lot of fun, as it has allowed me to use some of the Flash Player APIs which I really haven’t had …

Relative performance for collision detection techniques in ActionScript 3

If you have read my blog any this week, you have probably noticed that I have been doing some basic research on collision detection within the Flash Player. As part of this, I have put together a simple test suite, showing the performance of a couple …

Strategies for optimizing collision detection with BitmapData.hitTest

Yesterday I blogged about how you can use the BitmapData.hitTest API to do collision detection between the visible parts of multiple DisplayObject instances. This works very well, but as some of the BitmapData apis can be cpu intensive (particularly …

Using BitmapData.hitTest for Collision Detection

The Flash Player contains a number of APIs for handling collision detection within Flash content. The DisplayObject class contains hitTest and hitTestPoint which can be useful if you need to detect bounding box collisions, or detect collisions …

Monitoring File Changes in Adobe AIR

I have just uploaded a new class to the as3corelib library that makes it easy to monitor files for changes. The class is called FileMonitor, and is in the com.adobe.air.filesystem package. Here is a simple example of it in use: import …

Monitoring System Volume changes with Adobe AIR

I am at FITC Amsterdam this week, where I had a talk on Desktop Development with Adobe AIR. One of the things I showed was how to get notifications when new volumes / drives are added / removed to a machine. This could be useful if for example, you …

Getting the File URI of a File in an AIR app's install directory

I am currently working on some code that runs in Adobe AIR where I need to access the File URL file:/ of a file located in the AIR app’s install directory. Normally, you could get the URI, by accessing the url property of the File object which …

Functions, activation objects and 'this' in ActionScript 3

I have been reading through Colin Moock’s Essential ActionScript 3 book, taking my time on each chapter to make sure I get the most out of it. I have been using ActionScript 3 pretty consistently for a couple of years (about a year before it …

ActionScript 3 Vector / Array Performance Comparison

In my original post on the new Flash Player 10 Vector class, I did a simple example that showed Vectors being slightly faster than Array when just populating and looping through collections. Below is another example that shows a more significant …

Encapsulating Custom Pixel Bender Filters in ActionScript 3

If you read my blog regularly (or just today) you should have noticed that I have been playing around with some Pixel Bender filters and ActionScript / Flex (all inspired by Lee Brimelow`s video screencast on creating and using Pixel Bender filters …

Reading and Writing Local Files in Flash Player 10

One of the new features in Flash Player 10 are new ActionScript FileReference APIs that allow Flash content to directly read and write data to the user’s system. Prior to Flash Player 10, in order to read or write a file to the user’s …

Using Vectors in ActionScript 3 and Flash Player 10

One of the new ActionScript features included in the Flash Player 10 Public Beta is the inclusion of a Vector class. Essentially, the Vector class is a typed Array, and in addition to ensuring your collection is type safe, can also provide (sometimes …

POC - Implementing HTML 5 Video Element using JavaScript and Flash

Since the first leg of the European on AIR Tour wrapped up, I have had some time to take some time and research / play around with some new technologies. In particular, I have been looking into the HTML 5 draft spec, as well as some of the work that …

Parsing RSS 2.0 Feeds in ActionScript 3

One of the ActionScript libraries that I use most is the as3syndicationlib. This is an opensource library originally developed by Christian Cantrell, and open sourced by Adobe. The library provides code for parsing RSS 1.0, RSS 2.0 and ATOM data …

Detecting whether an AIR application has run before

One of the things that you might need to do when building your application is detecting whether your application has run before. This can be useful if you need to initialize settings, or perhaps prompt the user with some information. Below is a …

AIR Example : Native Drag and Drop

Here is a simple example that shows how to enable your Adobe AIR application to accept native drag and drop operations. This is a simple application that allows you to drag a text file into the application and then view its contents. …

AIR Example : HTML Editor with live preview

As part of my Flash on the Beach Intro to AIR Session, I built a simple HTML Editor with a live preview. I have added comments to the code, and uploaded it to the on AIR tour google repository. This example demonstrates: Using the File API to write a …

Initializing for loop counter outside of loop in ActionScript

Continuing my series of posts of interesting, but not too useful ActionScript tips (which I learned from studying Objective-C), did you know that you don’t have to initialize your counter variable within a for loop. For example, this is …

Using Bitwise XOR to exchange variable values in ActionScript

I have been studying some Objective-C in my spare time, and was reading up on Bitwise operators tonight. I came across a simple way to exchange the value of two variables using the Exclusive-OR (XOR) operator that doesn’t require creating a …

Serializing File Reference Instances in Adobe AIR

In one of the projects I am working one with the Adobe AIR bus tour, I had a need to serialize instance of File class to the file system. Normally you can do this with File.writeObject(), but as the player serializer / de-serializer does not know …

ActionScript 2 to ActionScript 3 Cheatsheet

Sean Moore has just posted a useful ActionScript 2 to ActionScript 3 Migration Cheatsheet. You can check it out here.

ActionScript 3 : Get a Class Reference by Class Name

If you need to get a reference to a class in ActionScript 3, but only know the class name, then you can use the flash.utils.getDefinitionByName to create an instance of the class. For example: package { import flash.display.Sprite; import …

ActionScript 3 : flash.util.Proxy

Ted Patrick has a good write-up of the new ActionScript 3 flash.util.Proxy class. What is the Proxy class? From the API docs: The Proxy class lets you override the default behavior of ActionScript operations (such as retrieving and modifying …

Using ObjectUtil.toString() to trace properties of an Object

If you need to get a quick view into an Object or class instance, you can use the mx.utils.ObjectUtil.toString() API included in the Flex 2 Framework. package { import flash.display.Sprite; public class ViewType extends Sprite { import …

Example : Iterating through Attributes using E4X in ActionScript 3

Werner Sharp (one of the Flash Player engineers responsible for E4X in the player) posted an example on the FlexCoders list showing how to dynamically iterate over XML attributes and their values using E4X in ActionScript 3. I wanted to post it here …

W3CDateTime ActionScript Class

As part of the ActionScript 2 Atom class that I am putting together, I have created an ActionScript class that represents a W3CDateTime string. This is the format that Atom uses to represent dates. A beta of the class and simple usage example is …

EventProxy.as : Proxying Events

One of the issues I ran into while building the MXNA WebService example app, was that both the ComboBox and DataGrid both broadcast “change” events. This meant that I could not have a separate function to listen for each event (and have …

Filtering Traces from Central with the Trace Panel

If you have used the Central trace panel, you may have noticed the “App Name Filter” text field in the bottom left of the panel. This is used to filter trace messages coming from Central so you only see messages coming from your …

Retrieving Values for 3D Bar Chart Component

A question was posted to my weblog asking how to retrieve the data for the individual bar chart section selected in the 3D Bar chart included as part of the Flash Charting Components Set 2 on DRK 4. If you are using a listener to capture the select / …

Detecting misspelled variable names in ActionScript

One of the big hassles of developing with ActionScript is that when trying to access properties and functions that do not exist, the Flash IDE does not throw an error. This can make it very difficult to debug code that is not working due to something …

Adding SHIFT / CTRL Click support to links in Flash

One of the requests that I got for the Google search application that Josh Dura and I have been working on, is to give the user the option to open links in a new window. This makes sense, since if you leave the page, the Flash application looses its …

Looping Through DataProviders in ActionScript

I have received a couple of emails over the past couple of days, asking how to manually loop through a RecordSet / DataProviderClass. It is actually pretty simple and utilizes the getItemAt() and getLength() methods of the DataProviderClass (pseudo …

Config.as

Simple class that loads config files. You can view the documentation here. This is provided as is, but please post any errors, corrections or suggestions in the comments below. #include "stringUtils.as" /* Config.as v1.0 created by mike …

Config.as / stringUtils.as

I don’t have much to post this morning, so I posted some ActionScript code that I created when I first started to play around with Flash MX. I have posted two things: Config.as - This is a class that can load and parse config files of various …

stringUtils.as

Simple library that adds useful methods to the String object. You can view the documentation here. This is provided as is, but please post any errors, corrections or suggestions in the comments below. Download here /*String Utility Component version …

Calling Web Services from Flash MX

There has been a lot of discussion within the Flash Community concerning calling web services from Macromedia Flash. This seems to have been prompted by google making available a web service for their search engine. So i thought i would give a quick …
twitter github flickr behance