Archive for Astro
How to use custom Shaders in Astro(Flash 10)
Here is a simple example using the sample exposure shader that comes with the Adobe’s PixelBender tutorial.
(Moving the mouse from horizontally will change the exposure value)
Firstly, you need the PixelBenderToolkit(http://labs.adobe.com/wiki/index.php/Pixel_Bender_Toolkit).
I used the Exposure sample code from Adobe’s Pixel Bender tutorial (http://labs.adobe.com/wiki/index.php/Pixel_Bender_Toolkit:Tutorial)
kernel NewFilter
< namespace : “your namespace”;
vendor : “your vendor”;
version : 1;
description : “your description”;
>
{
input image4 src;
output pixel4 dst;
parameter float exposure
<
minValue:float(-0.5);
maxValue:float(0.5);
defaultValue:float(0.0);
>;
void
evaluatePixel()
{
float4 inputColor = sampleNearest(src, outCoord());
dst.rgb = pow(inputColor.rgb, float3(1.0 - exposure));
dst.a = inputColor.a;
}
}
On PixelBender Toolkit, you can export it as Byte Code Filter for Flash from the File menu.
Exporting it, you will have a .pbj file to be loaded as ByteArray from Flash just like this.
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.addEventListener(Event.COMPLETE, urlLoaderComplete);
urlLoader.load(new URLRequest(“exposure.pbj”));
And after that, creating a Shader instance, and also the ShaderFilter to be applied on a DisplayObject.
{
shader = new Shader(ev.currentTarget.data as ByteArray);
shaderFilter = new ShaderFilter(shader);
filters = [shaderFilter];
}
Once you have the shader instance, you can change the shader parameters by doing the following.
filters = [shaderFilter]; //re-applying the filter
Easy huh?
Here is all the source from this little tutorial.
Enjoy.
(update. Just because Zeh said to)
One more example using the TwirlFilter created by Elba Sobrino.
Works the same way, move the mouse along the image.
Flash Player 10 - Aka Astro
Adobe launched a Flash Player 10 beta, aka Astro.
I’m just posting some links about Astro and Flash CS4 that I found. I anybody wants more info about it, just google it.
Astro release notes: http://labs.adobe.com/technologies/flashplayer10/releasenotes.html
Astro demos and videos: http://labs.adobe.com/technologies/flashplayer10/demos/index.html
Native3D sample code: http://download.macromedia.com/pub/labs/flashplayer10/sampleSource/Native3D_Sample.zip
An example using InverseKinematics (Flash CS4 new feature): http://theflashblog.com/?cat=34
Dynamic sound generation in Flash CS4: http://www.kaourantin.net/2008/05/adobe-is-making-some-noise-part-1.html
http://www.kaourantin.net/2008/05/adobe-is-making-some-noise-part-2.html
http://www.kaourantin.net/2008/05/adobe-is-making-some-noise-part-3.html
(update) And, if you want to build a Flash 10 content, you need the last nightly build Flex 3:
http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10+Beta+with+Flex+SDK+3.0.x