Archive for the ‘Actionscript’ Category

Add haXe to your toolset

haXe is an amazing project.  I've been looking at it recently as an option for producing swfs that potentially perform better than ones produced with similar code written in AS3.  Even more interesting, however, is the ability to target more than one platform with the same code base.  There are several target platforms but the one that captures my attention at this moment is the Javascript target and the fact that existing Haxe libraries such as Physaxe can be used with the HTML5 Canvas element.

The Physaxe library contains a custom type called JsCanvas that acts as a wrapper for the Canvas element and it's 2d drawing context.  JsCanvas shares the same method names as the graphics property belonging to display objects in Actionscript.  Compiler conditionals are then used in another class called FlashDraw to determine whether or not a member variable will be of type flash.display.Graphics or phx.JsCanvas.

It's worth checking out.

Posted by admin on June 3rd, 2010 1 Comment

FDT Flixel Templates

I'm familiarising myself with the features of FDT now that I have a copy and came across some useful templates here.  Decided to try making some myself for some of the Flixel classes;

  • create a subclass of FlxGame with a frame metatag for specifying a preloader
  • create a basic menu state with some basic presets added
  • create a subclass of FlxPreloader
  • create a subclass of FlxState that overrides create and update
  • create a subclass of FlxSprite that overrides update, hurt, kill and reset

Download here

You can add it to FDT by going to:

Preferences/FDT/editor/Templates - Import

Posted by admin on March 17th, 2010 No Comments

PureMVC notes

Here are notes that I wrote down during Javier Julio's PureMVC talk at FITC Amsterdam a couple of weeks ago.  I intend to use pureMVC and they'll be a useful reference when the time arrives.  If I have glaringly misconstrued anything please let me know :-)

The Proxy and Mediator

  • The Proxy typically sends notifications
  • The Mediator receives notifications and can also send notifications
  • The Proxy is located in the Model and is a natural location for domain logic, something that tends to be wrongfully be placed in Commands
  • The Mediator performs the key task of separating the View and Model (which is the responsibility of the Controller in Cairngorm)
  • The Mediator and Proxy have a similar setup
  • Methods to override in the Mediator include;
    • listNotificationInterest(),
    • handleNotification()

About Commands:

  • Since service interaction occurs in the Proxy (located in the Model), commands in the Controller are limited to things like; startup, shutdown.
  • A Command is used when you want to do multiple things in response to a notification.
  • Mediators can directly call methods on the Proxy instead of sending a notification.  You don't have to create a Command for everything.
  • Method to override in Command
    • execute()

The Facade

  • Facade is where you retrieve, register and remove actors.
  • The Proxies, Mediators and Commands all have access to the Facade.
  • Some of the methods to override in Facade:
    • retrieveProxy(proxy)
    • registerMediator(mediator)
    • registerCommand(command)

Update:

Javier got in touch with me and kindly pointed out a couple of things that I had got wrong and also offered some encouragement.  These are a few points he made (I've made the amendments to my notes above):

"The Proxy contains controller-like code but is actually in the Model part of the architecture"

Javier - I'm not sure where you picked up this one but definitely not the case, or at least not for the Proxy. You'll find that the Mediator already acts like a controller and that can trip people up about the framework. The reason for this is that the Mediator already does the key job of separating the View Component from the Model (e.g. a or many Proxy class) thus you don't really have a huge need for commands, in fact very little. This is expected and because the Mediator essentially acts like a controller.

"...Controller are limited to things like; startup, shutdown, database calls."

Javier - I could be misunderstanding database calls here as you could mean that a Proxy that makes a call to the server to fetch data from a database but was triggered by a command. Or say an AIR app that can interact with SQLite. But things like that you want to avoid having in the Command and move into the Proxy. This is one of the big differences between PureMVC and other frameworks because by moving service interaction into the model we can achieve portability and reusability.

"Mediators can directly call methods on the Proxy instead of sending a notification sometimes.  You don't have to create a Command for everything."

Javier - Cliff Hall, the creator of PureMVC, and others, especially myself couldn't be more proud. :) You learned probably one of the most important things to take away from the presentation. A lot of people get this wrong. I use the word "wrong" as Cliff has stated very good reasons why this is not only acceptable in the framework but pushed for you to do. Don't create a command class for an action that only ever happens in one place, you are just doing more work and adding more bloat.

Posted by admin on March 11th, 2010 1 Comment

OSS Barcamp, Dublin; Slides

I gave a lightening talk on Flex using the Flash Develop IDE at OSS Barcamp in Dublin at the weekend.  It was quite a challenge fitting everything into 15 minutes but I just about managed to fit a code demo in.  Here are my slides:


It was great listening to talks and speaking with people involved in technologies other than Flash Development.  Next week I plan on attending the Drupal weekend in Galway after meeting a couple of the Drupal guys on Saturday.

Posted by admin on March 30th, 2009 2 Comments

Video and subtitles using Flash: Flv, cuepoints and Actionscript 3

Stéphane Le Merre, a Flash Developer from the south of France, has written articles on his blog relating to accessibility on the Flash Platform.  This article walks the reader through how to create subtitles for a Flash Video File (flv) and references an article I wrote a few years ago over on actionscript.org.

Thanks for providing a follow up to this Stéphane.

(The article is in French by the way)

Posted by admin on March 24th, 2009 No Comments