I was creating an online gallery for a project at work when came across the need for dynamically created reflections. We had an existing class that we usually used for reflections, but it was a bad port from AS2 to AS3 and I was never happy with it. It tended to be hard to work with and pretty inefficient.
In an attempt to make things better, and make my life easier in the process, I sat down and created my own Reflection class.
Here is what I came up with.
Below is a sample of the result. The moving text shows how elements fade away from the reflection point. Also, if you click and drag in the top half of the image you will see how the reflection can update dynamically.
The idea behind the class is pretty simple. Basically, you create a new Reflection object and then pass it any display object that you want to reflect. Then, whenever you tell it to ‘refresh’, it will look at the target object, copy the bottom area, flip and fade it.
It uses the bounding rectangle of the target object to figure out what to reflect, but you can also override this by specifying a rectangle area to reflect.
You can also specify a number of different things, such as how tall you want the reflection be, how often it should refresh, and how transparent it should start and finish.
If you would like to check out the code for this reflection class you can do by downloading it here: Reflection Class AS3