The beta release of Flash Player 10, code named Astro, is now out on Adobe labs!
After download you can check out couple of simple demos I wrote using new features:

Spherical Mapping – rotating 3D globe with alpha support. This version runs in CPU, if it seems slow …

ThreePointGradient – a colorful gradient by specified three colors and points – the colorPickers are as well dragable, try moving and changing colors ! it’s not a build-in function of graphics API, but an example of pixel bender-shader rendering a fill …
There’s not much information on the net – yet. Senocular has posted a tutorial of new features.
and here’s CJ’s demo with lightbeams !
… more info and source for ThreePointGradient.
( edit 29 Sept 2008: AE CS 4 seems to have a four color gradient !)
… check also out version of rotating globe using graphics.drawtriangles() !






Here we go
package testi2_fla
{
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
dynamic public class MainTimeline extends MovieClip
{
public var tfield:TextField;
public var timing:Timer;
public var loader:URLLoader;
public var mc:Sprite;
public var rotX:Number;
public var rotY:Number;
public var rotZ:Number;
public var shader:Shader;
public var h:int;
public var w:int;
public var shaderFilter:ShaderFilter;
public function MainTimeline()
{
addFrameScript(0, this.frame1);
return;
}
public function mouseMove(param1:MouseEvent) : void
{
this.shader.data.lightsrc.value = [mouseX, mouseY, 0.48 * this.h];
return;
}
function frame1()
{
this.w = 600;
this.h = 300;
this.loader = new URLLoader();
this.loader.dataFormat = URLLoaderDataFormat.BINARY;
this.loader.addEventListener(Event.COMPLETE, this.onLoadEvent);
this.loader.load(new URLRequest(“hydra/SphericalMapping.pbj”));
this.rotX = 0;
this.rotY = 0;
this.rotZ = 0;
return;
}
public function doRotation(e:Event) : void
{
var _loc_4:Number;
var _loc_2:* = new Matrix3D();
this.rotX = this.rotX + 0.5;
this.rotY = this.rotY – 4;
this.rotZ = this.rotZ + 0.1;
_loc_2.appendRotation(this.rotX, Vector3D.XAXIS);
_loc_2.appendRotation(this.rotY, Vector3D.YAXIS);
_loc_2.appendRotation(this.rotZ, Vector3D.ZAXIS);
var _loc_3:* = new Array();
for (_loc_4 in _loc_2.rawData)
{
_loc_3.push(_loc_4);
}
this.shader.data.rot3D.value = [_loc_3[0], _loc_3[1], _loc_3[2], _loc_3[4], _loc_3[5], _loc_3[6], _loc_3[8], _loc_3[9], _loc_3[10]];
this.mc.filters = [this.shaderFilter];
return;
}
public function onLoadEvent(e:Event) : void
{
var _loc_2:* = new Bitmap(new MapImage(600, 300));
this.w = _loc_2.width;
this.h = _loc_2.height;
this.shader = new Shader(this.loader.data);
this.shader.data.imageSize.value = [this.w, this.h];
this.shader.data.rot3D.value = [1, 0, 0, 0, 1, 0, 0, 0, 1];
this.shader.data.lightsrc.value = [this.w, 0, this.h];
this.shader.data.radius.value = [0.45 * this.h];
this.shader.data.center.value = [200 , this.h / 2];
this.shaderFilter = new ShaderFilter();
this.shaderFilter.shader = this.shader;
this.mc = new Sprite();
this.mc.addChild(_loc_2);
addChild(this.mc);
this.mc.y = 50;
addEventListener(Event.ENTER_FRAME, doRotation);
addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
this.mc.filters = [shaderFilter];
return;
}
}
}
By: Quekette polue on May 27, 2008
at 11:17 pm
Yes, that’s a very clever comment. Ok, You must be some Don Quijote fighting people who don’t share their code. Thanks for finding my code that interesting ! – by the way, it’s not necesserly to use this. that much !
… maybe I should make this a tutorial,
like for instance in function doRotation, how the Matrix3D class has been used for counting the spatial rotations, and how that’s passed to shader’s float3×3 parameter, so that it’s all counted once in actionscript, not pixel by pixel in shader code (sin & cos, heavy operations) resulting a much better performance
And the pbj – can you open that also ?
By: pixelero on May 31, 2008
at 7:23 pm
[...] … and earlier demo of a rotating globe with pixel bender [...]
By: Flash 10, Part 6 of testing drawTriangles, rendering by vertices « Pixelero on October 9, 2008
at 5:54 am
haha good comment on a stupid comment
By: kris on November 20, 2008
at 9:12 am