Factum Vicesimus Quartus

Exploring web x.0, innovation and RIA techniques

Add to Google

ReflectionManager v0.9

April 26th, 2007

<– I have updated the Reflection Manager. The new version can be found overhere –>

Last week I needed a reflection at the bottom of the application I was working on. After searching the internet for a while I found some reflection classes on my favorite Flex resource, Flexbox. But after testing 2 of these I saw that the smoothness and speed of my application was decreasing drastically. So I took some time to figure out the structure of the reflection and came up with some ideas on improvements that I could built in. I wrote a new Reflection Manager, which I think is a little more efficient in some ways. I separated the bitmapdata for the alpha gradient and the component copy so that I can update them separately and then combine them into 1 bitmapdata by using the copyPixels method. I did this so it only draws the alpha gradient bitmapdata once and only updates the component data when the Flex UpdateEvent occurs. When the component or the reflection is resized, it also updates the alpha gradient data. This saves quite some CPU power.

ReflectionManager v0.9

The height of the bitmapdata is equal to the height given by the user for the reflection and not the entire height of the component your reflecting. Less pixels are drawn this way which you don’t see after all. There are still some improvements to be made but it’s a good start I think. Check it out!

Open the Reflection Explorer.
View source.

Let me know what you think, suggestions on how to improve the Reflection Manager are welcome as always.