Posted by: pixelero | May 17, 2008

Flash 10 – Astro available, some demos

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 …

– 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() !


  1. Here we go

    package testi2_fla
    import flash.display.*;
    import flash.filters.*;
    import flash.geom.*;
    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);

    public function mouseMove(param1:MouseEvent) : void
    { = [mouseX, mouseY, 0.48 * this.h];

    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;

    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[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.shaderFilter];

    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.w, this.h]; = [1, 0, 0, 0, 1, 0, 0, 0, 1]; = [this.w, 0, this.h]; = [0.45 * this.h]; = [200 , this.h / 2];
    this.shaderFilter = new ShaderFilter();
    this.shaderFilter.shader = this.shader; = new Sprite();;
    addChild(; = 50;
    addEventListener(Event.ENTER_FRAME, doRotation);
    addEventListener(MouseEvent.MOUSE_MOVE, mouseMove); = [shaderFilter];

  2. 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 float3x3 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 ?

  3. […] … and earlier demo of a rotating globe with pixel bender […]

  4. haha good comment on a stupid comment 😀

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: