Flash Bitmap and Spectrum Experiments


About the Experiments


This was my first attempt to learn Action Script and Flex.

I began by researching and implementing a way to do double buffered rendering directly on a Canvas (Flex Container).  Since Flex didn’t provide this out of the box, I had to implement my own double buffered Canvas rendering algorithm.

This has a disadvantage, you can’t use Flash’s display classes (Image, Sprite, Movie Clip) to draw your objects, you have to do it all manually, pixel by pixel. Operations such as rotating and scaling were fun problems to work out.

I initially implemented the Star-Field state by scaling bitmap images of 20*20 pixels. This brought my framerate down to about 20. Then I decided to write a draw sphere algorithm and my framerate went right back up to 100. My first flash optimization successful!

Working on the pixel level taught me some important skills: how to manipulate pixel data with matrices (to scale and rotate), and how I can get a massive performance boost by doing my own pixel coloring, instead of using images (which is essential in flash).

Full Source code is available for viewing and downloading.

Note: This is a Flex Project, so you will need to have the Flex SDK to be able to compile it.

Taken by CrazySam » Posted on May 14, 2010 » Filed in Open Source » Link

Comments are closed.

My Github