Google Ranking

Mmmm I have just been looking at my ranking for some Google searches.

I have come to the conclusion, that for an ActionScript Developer working in Brighton with both ActionScript 2 and ActionScript 3 in Flash, Flex and Air, I don’t mention the fact enough.

I mean, if you put “Brighton Flash Developer”, “Brighton Flex Developer”, “Brighton Air Developer”, I just don’t show at all! Even “Brighton AS3 Developer” gets Nada.

So, I guess I need to be a little more proactive in my choice of words….

Brighton Freelance Flash/Flex Developers

In the spirit of community, I am posting a list of AS3 developers whom I would personally recommend, should I (obviously top of this list) not be available.

These are top guys, contact them now!

Neil Manuell (revision)
Matt Pearson (zenbullets)
Matt Sayers (soplausable)
Owen Bennett (steamboy)
Rich Willis (rich text format)
Nikos Chagialas (devGallery)
Nick Kuh (nick kuh)
and
Pedr Brown

These guys are all members of the award nominated social network of FlashBrighton

a tiny bit of bitmasking

Bit masks are good for managing many boolean values within a class. For example, here is a theoretical Alert class, which can show any combination of five buttons: OK, YES, NO, CANCEL, MAYBE. Instead of creating a boolean property for each of these, we can store all this info on one property (in this example the flags property).

Firstly, for readability, we can map each button type to an uint as an enumerated constant:

public static const AlertButtons.OK:uint = 1;
public static const AlertButtons.YES:uint = 2;
public static const AlertButtons.NO:uint = 4;
public static const AlertButtons.CANCEL:uint = 8;
public static const AlertButtons.MAYBE:uint = 16;

then, these constants can be applied to the flags property using the bitwise OR operator ( | ).

myAlertBox.flags = ( AlertButtons.YES | 
                     AlertButtons.NO | 
                     AlertButtons.MAYBE )

We can then test the flags property against the enumerated value for each button using the bitwise AND operator ( & ).

if (flags & AlertButtons.OK) trace("OK");
if (flags & AlertButtons.YES) trace("Yes");
if (flags & AlertButtons.NO) trace("No");
if (flags & AlertButtons.CANCEL) trace("Cancel");
if (flags & AlertButtons.MAYBE) trace("Maybe");

pureMVC simple StateMachine utility

*Update see this post for the latest version*

Here is an implementation of a simple State Machine for pureMVC that I whipped up for a project. This is really useful for anyone creating applications, honest, its saved my life a few times :) It suddenly occurred to me that because its so simple I’ve been taking its power for granted, and I should share it for the greater geek good. I’ve been using it in combination with trilec’s command chaining utility as a way of controling my command structures.

Have put the code in the svn on my google code page and will prepare a download when I’ve documented it.

Initiate the StateMachine

// instanitate 
var stateMachine:StateMachine = new StateMachine();
// register with the facade before registering any commands
facade.registerMediator(stateMachine);
// create a state 
var state:State = new State(ApplicationStates.STATE_ONE)
// register the commands to be triggered when 
// entering and exiting that state 
stateMachine.registerStateChangeCommands(EnterStateOne,
                                         ExitStateOne,
				         state);
// repeat for each state (this can be done any time)
state = new State(ApplicationStates.STATE_TWO)
stateMachine.registerStateChangeCommands(EnterStateTwo,
                                         ExitStateTwo,
				         state);

Changing State
This is very simple, just send a notification from anywhere within the pureMVC framework with a new state as its body:

// create a state 
var state:State = new State(ApplicationStates.STATE_TWO)
sendNotification(StateNoteNames.CHANGE_APPLICATION_STATE,
                 state))

[kml_flashembed movie=”http://www.revisual.co.uk/uploads/2008/oct/statemachine/state_machine_demo.swf” height=”300″ width=”470″ /]