360|Flex day 3: Saffron, How’d He Build That? with Sam Agesilas
Wednesday 10 am. He is what is commonly known as a “devigner” but he hates the term. He prefers the term “designgineer.” He came to the Flash community about 9 years ago as a tweener. Slowly but surely gravitated to ActionScript, doing some Flex stuff, and so on. Want to concentrate on code and walk through how the hell he did all this stuff.
Sometimes he uses Flex Builder, sometimes he usex TextMate. It can take two or three miutes to build a big monolithic project in Flex Builder, so I package things to separate folders and have separate build systems to do that.
It’s a small core, and everything else is a plugin. The menus are a plugin, the view is a plugin. As dvelopers you can extend the product, create your own perspectives, and so on. I’m going to import the PaperVision3 library. It has parsed all the Papervision classes and created models for all of them.
He tried to keep Saffron to the UML spec as much as he could visually, but the UML spec was created by developers, not designers, so he tried to make it prettier. When trying to figure out how to organize the packages visually, he decided to tile them. Trying to figure out whether to do envelopes or not. Do people want them? He is working on a tree explorer to inspect all your packages. Maybe that is sufficient.
He is only doing an AIR version for now. Thinking about what a browser version might do but not right now. All 360Flex attendees are getting an alpha invite, but after Sept 1 there will be regular builds.
To improve performance he is only putting what’s visible on the display list, and removing objects when they go out of view.
Amazingly, a lot of the objects inside the main view are not Flex components but Flash components built in Flash Professional and brought into Flex. He hates to skin with typing, likes to draw. He is using Elemental, a Flash class library, for a lot of this. Elemental separates visual code from interaction code. You can draw anything you want, pass an instance of that class, Elemental will inspect the class, figure out where to hook into.
Saffron Application Manager. This is the main Saffron class. He’s not using Cairngorm, partly because he doesn’t like to type that much, but partly because he took what he liked from Cairngorm and threw away the rest. He’s using a Command pattern but that’s pretty much it.
As a habit, he always hangs onto objects, never just creates them and leaves them around to be GC’ed, always assigns them to class variables and nulls them out as soon as possible. Makes things more predictable.
Trying to access Flash objects from Flex is incredibly painful. Challenge is that Flash does not have native support for AIR. The Saffron window manager has a property called associatedClass that is a Flex class that gets bound to that CS3 class. This is something the Saffron API does for you. The net result is that it makes it easier to integrate Flash and Flex.
He is using a “signals and slots” pattern from QT, rather than the traditional event model that Flex provides. He is basically translating between the two models so that he can use signals and slots internally.
He’s talking about how he parses ActionScript 3. He had to dust off the dragon book for a quick compiler refresher course. He’s also working on parsing MXML, but not yet. He’s using the built-in regular expression support in AS3. It’s pretty fast for the most part, but look ahead negation is very very slow so he has to use a divide and conquer algorithm to work around that. He tests against the Flex Framework SDK since it has a lot of different coding styles and is a good stress test of memory consumption.
Technorati Tags: 360Flex




Hello all,
The Saffron Modeler looks awesome, but it seems to have disappeared. Does anyone know if he is still working on it and if so, where the project currently stands?
Thanks,
Shawn