You are currently browsing the monthly archive for April 2007.
This morning, Adobe announced that they are open sourcing Flex (under the MPL). Their FAQ is pretty informative.
Slashdot’s gallery of morons is lambasting the announcement as just a PR stunt, as a scared response to Microsoft’s recent announcement of WPF/E Silverlight, and likely as a joint conspiracy between Sony, the Bush administration, and Jack Thomspson to steal their mp3z. But you can’t make some idiots happy, no matter what you do.
I couldn’t be happier with this news. It’s a major win for not only Adobe (who gets fresh innovation and lots of good karma out of the deal) but also for the community in general. Flex is a tremendously powerful platform, it’s a serious platform. While Flash is just for pretty pictures, Flex is for content. It is fast to develop for, it is more reliable than AJAX (since it runs under a consistent VM that doesn’t change from browser to browser or OS to OS), and it looks better and runs faster than Java Swing (well, it doesn’t take much to look better than swing, or be faster than swing, but Flex does both, at the same time, and does it for less effort on the developer’s end).
Fact of the matter is, Adobe is open sourcing their compiler, their debugger, and their core language api. Really, the only thing they’re not opening up is the VM itself… but they’ve already done some of that. Adobe is also keeping control of the project, it’ll be hosted on their servers, etc… So between that, and their keeping the Flash 9 player closed source, the platform isn’t in danger of rapid death spiral type unreliability.
Ted Patrick has more details on his blog. Namely, the release schedule:
Starting Summer 2007 we will be posting daily builds of the Flex SDK and providing open access to a bug database online. The Flex community will have direct access to the same tools developers use internally to manage Flex quality and this will allow the Flex community to improve the quality of Flex directly.
In December of 2007 after the release of “Moxie” (aka Flex 3) we will be posting all software assets into a public Subversion repository for public access. During this transition period we will be clarifying governance on the Flex SDK and how contributions will be handled in phases.
Naturally, I’ve got more questions about this, but… I’m too excited to care at the moment.
I have the sinking suspicion that as one of the few groups on the planet to adopt Flex 2 as a development platform from its launch, a few of my comrades and I will be among the first to actually contribute code to the new Flex 3 project. We may none of us be compiler jocks… but I tell you what. We are going to fix a few broken/clunky UI classes and are gonna give the native data classes a good jolt of needed features.
I giggle at the thought of how much work DataGrid is going to see the first month
Ok, this one’s kind of silly. I’m not entirely sure why I threw this together, really. But I got bored during lunch and here it is – a simple no-frills AS2.0 (Flash 7+) movie clip depth management class for times when you’re attaching and removing tons of clips, don’t really care what order they wind up in or what they’re called, and want to avoid running out of space.
MovieClip.getNextHighestDepth() works fine for most cases, but it’s also a wee bit dumb in that it won’t re-use depths that you skipped over. Now, this can be a desirable feature, and I might take advantage of it in an upgraded version of this class in the future… but for now, what it means is that it is very easy to programatically ratchet yourself out of available depths.
note
My version 0.1 of my SDM class (ie, the code provided here) has been tested only lightly and works fine under low stress environments. But it does seem to have issues when it starts getting hammered by lots of requests at once.
I’ve got a new version that should help remedy this problem in the works, but no schedule for when I’ll be able to release it.
the source
You can download the source here: simpledepthmanager-01.zip.
class org.simud.util.SimpleDepthManager extends MovieClip {
///// private instance vars /////
private var _depth:Number;
private var _count:Number;
private var _mcl:MovieClipLoader;
private static var MAX_DEPTH:Number = 1048576; // 2^20
///// public vars for listening to the mcl /////
public var onLoadComplete:Function;
public var onLoadError:Function;
public var onLoadInit:Function;
public var onLoadProgress:Function;
public var onLoadStart:Function;
///// constructor /////
public function SimpleDepthManager() {
// init our depth counter
_depth = 1;
// init our mc count, this is just for instance naming purposes
_count = 0;
// init our mcl
_mcl = new MovieClipLoader();
_mcl.addListener( this );
}// end: constructor
/**
* Creates and returns an empty movie clip
*/
public function createClip() : MovieClip {
validateDepth();
var mc:MovieClip = this.createEmptyMovieClip( getInstanceName(), _depth );
return mc;
}// end: createClip
/**
* Attaches a symbol from the library and returns the new instance
*/
public function attachClip( id:String, init:Object ) : MovieClip {
validateDepth();
var mc:MovieClip = this.attachMovie( id, getInstanceName(), _depth, init );
return mc;
}// end: attachClip
/**
* Creates an empty movie clip and loads the specified clip into it.
*/
public function loadClip( url:String ) : MovieClip {
var mc:MovieClip = this.createClip();
_mcl.loadClip( url, mc );
return mc;
}// end: loadClip
private function removeClipAt( d:Number ) : Boolean {
var mc:MovieClip = this.getInstanceAtDepth( d );
if( mc == undefined )
return false;
mc.removeMovieClip();
// and save our new target depth
if( d = MAX_DEPTH )
throw new Error( "Unable to find a valid new depth." );
trace( "[debug] _depth = "+_depth );
}// end: validateDepth
}// end: class
the explanation
So, what does it do? Well, it extends MovieClip, first off. So in order to use it, you should either extend it further yourself or simply specify the class as the code behind your container MC.
The class provides the following simple methods for dealing with clips:
createClip()- Create and return an empty movie clip.
attachClip( id:String, [init:Object] )- Attach a symbol of the specified linkage id from the library, passing it an optional init object.
loadClip( url:String )- Use an internal MovieClipLoader to load an external swf or image into a new movie clip. If you want feedback from the loading process, simply set listener functions on your instance of the manager object as if it were the MCL itself (ie, onLoadComplete, onLoadProgress, etc…).
removeClip( mc:MovieClip )- And remove a movie clip.
You never have to look at instance id’s or depth numbers when using this. I intentionally used different method names (in stead of overriding the default behaviors of the existing Movie Clip management functions) in order to leave you the freedom to use the old methods if you ever need to.
I attempt to recycle old depths once you free them – the manager will always attempt to use the lowest depth that it knows about. If, for some reason, it fails to find a free depth into which to plunk something after 1000 attempts, the manager will fall back and call getNextHighestDepth().
the license
This class is made available under the Creative Commons Attribution 3.0 License. Basically, it means that you can do with it what you will, so long as you credit me for it.
