Posts categorized “Uncategorized”.

REST on the client reduces MVC to invisible plumbing

My new project RestController integrates an AS3 client with a Rails app delivering JSON. It exploits the fact that REST signatures are predictable in order to automate the web-cycle request:

1. Make a request.
2. Update the model with the response.
3. Trigger changes not triggered by the model change.

model.addProperty("posts");
model.bindProperty("posts", postList, "dataProvider");
 
//This request results in the postList being updated.
//AUTOMATICALLY, no other code necessary.
control.ask("posts", "posts", "index");
//So would show, create, update, and destroy actions:
controller.ask("posts", "posts", "destroy", somePost.id);

Imagine, no event, command or model classes…and it’s a mere five class files, so you can easily extend or cannibalize it. More at RestController.

Flex-Like States for AS3 Apps

When I went back to Flash, there was only one thing I missed about Flex: view states. So I created a states package for non-Flex AS3 applications. To get started, download the classes and place them in your class path. Then download the tutorial flas and open states1_skinScope.fla.

A STATE treats various UI shifts (move this here, move that there, shorten that other thing) as a group so they can be easily manipulated. States are configured in XML:

<state name="someState">
  <clip target="someClip" prop="visible" value="false"/> 
  <clip target="someOtherClip" prop="visible" value="true"/>
</state>

States are applied to instances of the SKIN class. Here is the easy manipulation part:

//a group of UI shifts are required...
someSkin.currentState="someState";
//a button is clicked
someSkin.currentState="someOtherState";

More… »