Check out these videos from the Adobe MAX conference in Chicago:
http://www.peterelst.com/blog/2007/10/
03/adobe-max-chicago-sneak-peeks/
The first video, Flash Next, shows some nice features coming in the next iteration of Flash. But the real gem is the second video, Flash on C/C++. Particularly the demo near the end. I had to pick up my jaw off the ground after that one! Quake in Flash!?
The presentation is unclear on what the technology is actually doing. Is it compiling C source into AS3 bytecode? This is what the video says, but that seems pretty crazy to me, especially after the Quake demo. If you squint at some of the slides in the video, you can see some blurry code: (~02:20 in the video)
var machineC:Class = Class(loader.contentLoaderInfo.applica tionDomain.getDefinition( ... ) );
var xmlPtr:int = __allocString( xml.toString() );
var xslPtr:int = __allocString( xsl.toString() );
var resPtr:int = __call(machineC, xmlPtr, 0 );
var retStr:String = __stringFromMem( resPtr );
This code shows us a lot more about what's really going on. It seems like the machine code is actually being embedded inside the Flash. Some native hooks are provided to place AS3 primitives in memory (__allocString), run the machine code (__call), and grab the result from memory (__stringFromMem).
This is somewhat less practical -- for one, I would imagine that you're losing platform independence if you staple some machine language with your Flash app. Second, it seems potentially insecure -- letting a developer grab pointers to memory is totally contrary to the Flash's draconian security policies! :)
Nonetheless, it's cool stuff! Most interesting to me, though, is that Flash is displaying Quake's framebuffer and playing Quake's dynamically generated sounds. Writing pixels to a BitmapData is still heinously slow in AS3, and there's no built-in way to generate sound from code, aside from the clever audio hack. I suspect functions like __bitmapDataFromMem were added to grab Quake's frame buffer. Something similar that would allow a quick way to draw to the screen would be a great addition to ActionScript.
JohnnyUtah
MIKE, your mustachioed cat is the most irritating user image in the known universe