Archive

Archive for the ‘programming’ Category

Navigatable ArrayCollection for Flex

March 18th, 2008 admin 1 comment

I’ve written a NavigatableList class to provide the already handy ArrayCollection class with a simple cursor-like navigation option. You can call list.navigateTo() and provide for instance list.next or list.previous. You also specify the class to which items should belong and you can search for an item with list.findItem(property, value). And finally, you can clone it with list.clone().

Download it here

EDIT: the clone() method didn’t work correctly for some reason. I’ve removed it for now.
EDIT: added an equals() method which compares this list to another list. You  must specify the  name of a unique property which can be used to check if two items are the same.

Categories: Flex, programming Tags:

AS 3.0 layout manager

February 25th, 2008 admin 5 comments

I’ve created a custom layout manager in AS 3.0 which provides some of the automatic scaling and positioning that Flex provides.

You can register objects and specify a size to maintain relative to the stage size, alignment, padding and set a function that is called when the screen is resized.

This is a first version and it may (and most likely will) change in the future.

Download: LayoutManager.as and LayoutTarget.as

Categories: programming Tags:

Processing – Arduino message queue

September 18th, 2007 admin No comments

When I was working on the software for my graduation project, I found I needed a way for Processing and Arduino to communicate safely, so that no messages would be overwritten, lost or sent in the wrong order. To this end I wrote a messaging system, the code for which can be downloaded here: http://www.rockabit.com/downloads/message queueing.zip

It basically works like this: processing sends numerical messages to the arduino I/O-board over a serial connection. To ensure safe messaging, every message is preceded by another message that specifies the type of message that follows. Arduino then first receives this type identifier, knows what type of message should follow, and then receives that message and sends back a confirmation to let processing know that the message was received. Only when a message is confirmed will processing send the next message in line. Also, if a message is not received for 2 seconds, it is resent, and if resending has no effect then it is placed at the back of the queue to be tried again later on

Categories: processing, programming Tags: