360|Max topic

Vote for me!


Threading in Flex

There have been several times where we have had to process large sets of data in our client side Flex applications. Several of these locked the UI for up to 15 seconds on slower machines until we started chunking up the work load.

Eventually, we solved this issue by developing a framework to instantiate and manage ‘thread’ objects. The threads are really just managed time slices.

The framework has the following features:

* easily instantiate and manage n number of threads
* threads have adjustable priority settings
* messaging between threads handled by reflective method handlers (similar to Fabrication for PureMVC)
* load balancing of thread executions in order to optimize performance
* easy and simple api: start(), sleep(), wake(), kill()
* threads can auto-adjust their workload based on the performance of the application. basically, if the app is slowing down, the threads can buffer down their work load. similarly, they can ramp their workload up if the application is running smoothly and the library feels that there is room for increased load.

This library has gone through our open source review board and has been approved to be released into the wild🙂

You can get it here:

The project archive file contains src, asdoc, and compiled swc.

Playing with Tamarin

I played around with Tamarin about a month ago and have been meaning to blog about it. Tamarin is the Adobe/Mozilla open source ActionScript virtual machine. You can figure out how to install and build it here (I don’t want to go through all of the gory details).

Building a project is fairly simple. You use the asc.jar (ActionScript compiler) to create an abc file (action byte code? alphabet a-b-c?). Then you run it with the avmshell. The first thing I did is write this awesome piece of code:

print("hello worlds.")

Note that we get a “print” function. The Tamarin ActionScript language is the same as the Flash/Flex AS3 that we all are used to, but it’s platform is different so the packages are different. The print function dumps text out to the console.

In my Mac terminal (Windows should be similar if not the same), I type:

java -jar ./tamarin-central/utils/asc.jar -import 
   ./tamarin-central/core/builtin.abc hello.as

And it makes hello.abc (which clocks in at a whopping 87 bytes).

./tamarin-central/objdir-release/shell/avmshell hello.abc

Outputs: “hello worlds.”

I did some digging around in the tamarin-central/shell path and found shell-toplevel.as. This has all sorts of good stuff in it… a File class memory in and out. A readline function. Here’s the next little test I wrote:

import avmplus.File 

var foo:Array = ["hello", "world", "yo"];
var i:uint = 0; 

for ( i = 0; i < foo.length; i++ ) { 
    print( foo[i] ); 

print( "writing to a hello2.txt..." ); 
File.write( "hello2.txt", foo.toString() ); 

print( "reading file..." ); 
try { 
    print( File.read('hello2.txt') ); 
} catch (e) { 
    print( e.toString() ); 

It outputs:

writing to a hello2.txt...
reading file...

And creates a “hello2.txt” along the way. Sweeet.

Now I just have to figure out what this is all useful for.🙂

Kashi = Monarch MVC


The time is 13:30 PST and the polls are closed. “Monarch” is now the the official name for Kashi. I’m gonna tack on “MVC” so “Monarch MVC”. Hopefully the name will strike fear and reverence into our, um, Flex code.

Vote for me!

Hey guys! Help vote my topics up! Just search for Symantec… http://360flex.uservoice.com/


Get every new post delivered to your Inbox.