Archive for the ‘ActionScript’ Category
AS3 Signals – the best thing since sliced bread
If you haven’t heard about Robert Penner’s AS3 Signals yet, you’re missing out. Until yesterday I had only briefly looked at the project but after John Lindquist’s video tutorial I’m completely sold on the idea and look forward to using it in my projects.
So what is AS3 Signals suppose to do for you?
Well for one it uses composition rather than inheritance so you don’t need to have your class extend flash.events.EventDispatcher. You can dispatch a “signal” and pass any number of arguments with it, no more endless subclassing of flash.events.Event for creating your custom events.
There’s also some nice features that you don’t get with the traditional event handling in ActionScript 3.0, things like addOnce which makes sure a listener only gets triggered the first time, removeAll which removes all listeners on a Signal and numListeners that returns the number of listeners on a Signal instance.
Apart from the generic Signal class, you also have DeluxeSignal which allows you to define the target (it also has some experimental bubbling support using .parent) and the NativeSignal which lets you map native events like MouseEvent.CLICK to a Signal.
This AS3 Signals project makes for an incredibly easy way of working with events inside of ActionScript. Give it a try and let me know what you think!
Watch the video tutorial
Looking back at The ActionScript Conference 2009
I was very happy to be invited to speak again at this second edition of The ActionScript Conference in Singapore. This year they even made it a two day event at an amazing venue overlooking Marina Bay. I have some video recorded that I’ll upload soon.
Shunjie and the rest of the team do an amazing job getting this all set up and they’re a great bunch to hang out with.
Some personal highlights of the conference were the talks by Alvin Zhang and Lionel Low. Alvin showed some great multi-touch demo’s on a touch table he built himself using the Diffused Surface Illumination technique (involves among other things a projector, PlayStation 3 camera and a diffusor). Lionel talked about “Warpspeed Flash” and highlighted various ideas to work smarter rather than harder. Its really great to hear from these local guys and topics that you don’t typically see at other conferences.
Was also particularly pleased to finally meet Himanshu Mody of Tekno Point and see my former colleague Arvind Singh again.
My session was called “Getting Creative with Adobe AIR”, it was originally a little more targeted at designers but decided to go with some more interesting API examples since the audience this year seemed to be more of a developer crowd.
I was pleasantly surprised about the questions I got and people coming up to talk to me about their projects. I’ve uploaded my slides and example code for those interested.
I have a few more days in Singapore before flying back to London for Flash on the Beach, going to make the most of it. Thanks again for all the guys working so hard to make this conference happen, hope to be back for the next few editions!
The ActionScript Conference 2009 Singapore
We’re about a month away from the next edition of “The ActionScript Conference” and I can’t wait! This conference has fast become one of my all time favorites and this year will no doubt be even better with two days of sessions scheduled in.
The speaker lineup looks excellent and includes people like: Ryan Stewart, Leif Wells, Andre Michelle, Marco Casario, Mohammed Khan and lots more local and international talent.
If you didn’t make it last year, its worth checking out Lee Brimelow’s video.
I’ll be doing a session called “Getting Creative with AIR” and showing how you can take advantage of the various APIs and get creative with them building some unexpected applications.
Hope to see you there! I’ll be in Singapore from September 12th until the 19th.
Get your ticket now: www.theactionscriptconference.com
Making the case for ActionScript
This last week or two we’ve seen a lot of heated debate around the future of ActionScript and the Flash Player. Its nice to see this kind of excitement and passion for the technology — yet I can’t help but feel we’re experiencing a form of ‘continental drift’ here.
I’ve seen ActionScript grow up from its humble beginnings with just a handful of frame actions to supporting prototypes, object-oriented syntactical sugar to where we now have a full fledged object-oriented programming model.
That is a good thing, right?
Yes and no. While I wouldn’t have dreamed it some time back when I was advocating object-oriented code as the one-stop solution to all your problems, I’m starting to feel we’re losing out on a lot that made ActionScript so appealing.
This is something Aral Balkan has been saying for the last year or two and I initially considered blasphemous. Is a focus on how to do things ‘properly’ holding us back getting things done? I believe so.
Is there anything now – excluding improvements to Flash Player performance – that could not have been done with ActionScript 1.0? Very little, though admittedly it now takes a lot less effort.
Read the rest of this entry »
Mobile Vikings API – ActionScript 3.0 implementation
I was very impressed to see Mobile Vikings (see earlier post) released an API that allows us to get hold of our account data.
I’ve spent an hour or two working on an ActionScript 3.0 implementation that you can use in your AIR applications. Right now they’ve provided three API calls: retrieve your SIM balance, see your call history and see your topup history.
Here’s how you set it up:
var api:MobileVikings = new MobileVikings("username","password");
Get your SIM balance
public function init():void
{
var api:MobileVikings = new MobileVikings("username","password");
api.getSimBalance();
api.addEventListener(MobileVikings.SIM_BALANCE_LOADED, balanceLoaded);
api.addEventListener(MobileVikings.SIM_BALANCE_FAILED, balanceFailed);
}
private function balanceLoaded(evt:SimBalanceEvent):void
{
trace(evt.credits);
}
private function balanceFailed(evt:Event):void
{
trace("fail");
}
When the SIM balance is loaded successfully you get access to credits, validity, SMS and data remaining etc.
Flash Builder 4 beta – exporting ASDoc documentation
Despite the excellent ASDoc integration added in Flash Builder 4 beta, it seems its still not easy to export to HTML and you need to set it up yourself using an external tool configuration.
I spent some time trying to figure it out and stumbled across a post by Seb Lee-Delisle that gives a good runthrough of how to set it up. Thought it would be useful to show how to set it up in Flash Builder 4 beta.
- Go to Run > External Tools > External Tools Configurations
- Select Program (left sidebar) and click the New button to create a new configuration
- Give your configuration the name “ASDoc”
- Set the location to “/Applications/Adobe Flash Builder Beta/sdks/4.0.0/bin/asdoc” (the default on Mac) on Windows the default is “C:\Program Files\Adobe Flash Builder Beta\sdks\4.0.0\bin\asdoc.exe”
- For Working Directory you can set it to ${project_loc}, this is a variable that always point to the location of your current project
- Finally you set up some arguments, assuming you put your code in the default “src” folder:
-source-path src
-doc-sources src
Those arguments set your source directory and tell the ASDoc tool to recursively go through all classes in that folder and its subfolders and generate the documentation.

To run the ASDoc tool and export your documentation to HTML, select your project and click Run > External Tools > ASDoc. When its finished scanning your code and generating the documentation you’ll find it in a folder in your project called “asdoc-output”. Enjoy!
Flash Builder 4 beta – my favorite features
In case you didn’t know yet, Flash Builder 4 beta (the product previously known as Flex Builder) is now available for download on labs.adobe.com, as is the beta for Flash Catalyst.
I’ve been playing around with the public beta for a little bit and thought it was worth blogging some of my favorite features in this release when it comes to features in the IDE. Up until now I’ve only tested it with pure ActionScript projects, so might discover some more gems later on.
Generating getter/setter methods
This is a huge time saver, you can now just define your class properties, right-click and select Source > Generate Getter/Setter and you get a useful dialog allowing you to specify how you want that getter and setter method set up. You can make your class property private, rename it, specify if you want the getter and/or setter, set up its access modifier and even define where you want those generated methods to get added in your code.

SWC introspection
If you work with library projects or third party SWC files you can now introspect those and figure out its packages, classes and methods. SWC files generated with Flash Builder 4 can also have their ASDoc comments embedded.

ASDoc integration
ASDoc is a tool that comes with Flash Builder for generating documentation from Javadoc style comments in your Flash Builder projects. There’s now a panel that shows the documentation for a selected property or instance, you also get a tooltip showing the documentation when you hover over them.
As mentioned earlier this also works with SWC files generated from Flash Builder 4, since those can now contain the ASDoc information (increases SWC filesize, but not filesize when exporting a release build).

Be sure to give Flash Builder beta a try yourself, I’m very pleased with what I’ve seen so far and am sure it will improve productivity significantly.


