Articles

Archive for the 'dpdk' Category

Wait for user input in your sequence

We’ve been using the task based sequence for a while now and are very pleased with it. One thing we missed, was the possibility to listen to an event.

Besides the ConditionalTask (which waits for an other Task to be completed), we’ve now added the EventListenerTask. This task waits until an object has dispatched an event before continuing the sequence.

Here is a code example

//create a new sequence that will hold tasks
var sequence: Sequence = new Sequence();
//wait until the user clicked on the 'myButton' instance
sequence.add(new EventListenerTask( myButton, MouseEvent.MOUSE_DOWN );
//call a callback method in the present scope
sequence.add(new CallbackTask(onDone));
//start the sequence
sequence.execute();

With this new Task it’s very easy to (for example) pause the Sequence until the user pressed a button or pressed a key… or until some other object dispatched an event.

multiuser as3 framework for flash media server and red5

Multiuser programming is a hard thing to do. Not only does it involve a different way of approaching a problem, it also means you have to learn to program the server and communicate with it and all of it’s connected clients.
The flash media server and it’s opensource variant red5 give us two perfect platforms to do complex multiuser interaction. While they differ in the way you write server code, they are the same when it comes to writing client side code for flash/flex.

Because there are no client side abstractions to multiuser programming out there, we wrote our own and share it with you here. In our nl.dpdk.services.fms package you can find a number of classes that abstract the gory details of interacting with either the flash media server or red5, making it easier to code, easier to maintain, easier to understand cleaner and less error prone. It still allows you to use advanced features and hack away at a low level, but makes it a breeze to setup a complex environment in a short time. The classes we present in our package focus only on data exchange and not on doing streams.

Since multiuser programming is extremely cool, gives you loads of possibilities to do fun stuff and does not need to be hard, we’ll try to get you up and running with fms in this post.
Continue reading ‘multiuser as3 framework for flash media server and red5′

On using sequences and tasks with the DrupalService

An example of how you can use custom tasks in sequences is demonstrated by the use of some Tasks in the DrupalService. This post will demonstrate how two very easy to create Task subclasses give you a general solution to handling a specific dataflow from Drupal. We will show you how you can abstract the repetitive flow of connecting to a drupal backend and getting a specific set of nodes from a certain view.
Continue reading ‘On using sequences and tasks with the DrupalService’

DrupalService as a bridge between flash and drupal

Drupal is a multiple award winning opensource content management system. With the drupal services module, it’s possible to consume data from drupal in flash. Drupal is a very powerful tool to provide data to flash movies and with the community investing much time in drupal services, now is a great time to be using drupal to power your flash websites. Services will be part of the drupal 7 core release.

We decided to release our nl.dpdk.services.gephyr package, which is a drupal as3 service which acts as a bridge between drupal and flash and features all the power of our as3 flash remoting package. It has the core functionality of the drupal services built in and is very easy to extend and to adjust to your needs. Furthermore, it makes use of all drupals’ security mechanisms via key and session based authentication.
It has more features and packs more power than any other opensource actionscript 3 based drupal package out there at the moment, so be sure to check it out.
Continue reading ‘DrupalService as a bridge between flash and drupal’

FramescriptManager: insert code on your timeline at runtime

In an earlier post we showed you how to seperate design and code by keeping code off the timeline at all times. The method was to have designers add framelabels to the movieclips’ timeline and have the developers react to the flash playhead reaching this framelable by means of an Event. This created a clean seperation between the job of coders and the job of designers.

We used the TimelineListener class as an example in that earlier post. This post will show you how to take an alternative approach, without event listeners, but by means of injecting code in a frame at runtime by means of our FrameScriptManager and the MovieClip.addFramescript method.
Continue reading ‘FramescriptManager: insert code on your timeline at runtime’

Asynchronous queue demo with a LinkedList

This post will show you the principle of an asynchronous queue, demonstrating it with the LinkedList structure in our package, used as a Queue by making it’s datatype nl.dpdk.collections.core.IQueue.

An Asynchrounous Queue is a queue that is processed with asynchrounous operations. Instead of processing a Queue in synchronous fashion, where you would remove all items from the queue in a loop, the items are removed only when the previous operation has finished (succesfully or not). The time when this is handled is not known in advance, and is event driven rather than procedurally driven.

Most browser cannot handle more than a couple of simultaneous http requests from flash, and just trying to load them all at once (in a loop) is error prone. A queue is a lifesaver in a case like this.
Continue reading ‘Asynchronous queue demo with a LinkedList’

Timeline Events via the TimelineListener class

While viewing a post on bytearray.org and after teaching a class on creative technology at the avans hogeschool today, I got inspired to write some easy code to be informed by the timeline of a Movieclip when a certain label is reached.

A student of mine slapped me in the face with my own words that “code on the timeline is evil” when he asked how he could trigger an action inside the flash Document Class from the timeline or from a specific framelabel. My reply was simple: just call a method on a certain keyframe that you have exposed in the Document class. < Sssslappppp > :) So I decided to show him the clean way by listening to an Event.ENTER_FRAME Event and checking the framelabel or the end of the timeline whenever the event handler got called. All from inside the Document class, no code on the timeline there.

I encapsulated the whole thing in a class, have it dispatch events you can register to and make it able to get some data out of it and at the same time make it work for different scenes (as he was working with them). In this way we can perfectly seperate design and timeline stuff from code, optimizing workflow by having designers tweak their animations and killer design while only informing the developer of some framelabels and eliminating spaghetti code and potential bugs.

For this purpose I wrote the TimelineListener class in the nl.dpdk.utils package. read on for some simple code.
Continue reading ‘Timeline Events via the TimelineListener class’

Factory for creating ResultSet from an SQLResult in AIR

There is a minor update in the nl.dpdk.air package.

While creating some AIR applications, it turned out the SQLResult, a resultset wrapper used when working with a local SQLite database is not as powerful as we want it to be. Therefore we wrote a little Factory to convert an SQLResult to an nl.dpdk.collections.sets.ResultSet.

Our ResultSet is also used when doing flash remoting and when returning data from a remote database, (see the post about that here).
So it’s convenient to use when working with local data from a database as well. As an added bonus, it offers some more features than the very simple SQLResult, which is essentially an Array of anonymous objects.

The ResultSet makes use of our very powerful List datastructure, which features sorting (which is better done by the database), selecting, mapping, folding and applying commands as well as a very rich api where you can use the datastructure as a Queue or a Stack.
Continue reading ‘Factory for creating ResultSet from an SQLResult in AIR’

Using a flashvars / flash parameters registry: configure your flash files externally

Providing data to your flash movie can be done through javascript, through loading data from xml, UrlVariables (post and get) or flash remoting with the actionscript message format (amf), or by passing FlashVars to your movie at embed time in your html page. We are using a software design pattern known as a Registry to be able to have easy access to our externally provided parameters known as FlashVars throughout our application.

Continue reading ‘Using a flashvars / flash parameters registry: configure your flash files externally’

folding, mapping and applying commands on datastructures and collections

Hi, we have a great update on the collections package featuring methods that allow us to map the list, fold it and to apply commands on every item in the list. This sort of extremely powerful functionality can be compared in intention to using specifications on collections on which we wrote an earlier post here. Some more updates include some bugfixes in the unittests and a stack overflow problem occuring only on macs. But this article will focus on highlighting the high level methods we just added. Want to have a huge boost in productivity and clarity of code??? Read on!
Continue reading ‘folding, mapping and applying commands on datastructures and collections’