Dynamic Reflection Generator Class for AS3

Hot on the heels of our Perfect Alpha Reflections Quick Tip comes this excellent utility class for dynamically reflecting your display objects, courtesy of Martin Christov.

How do I use it?
Step 1:
Copy the ReflectEffect.as file into the classpath of your Flash project (or the same directory as your FLA if you’re not using classpaths).
Step 2:
In your code, create a new instance of the ReflectEffect class, passing it the display object that you want it to reflect, like so:
var reflect:ReflectEffect = new ReflectEffect(movieClipToReflect);
Step 3:
Create a new variable for your reflected object and add it to the stage (or wherever you like):
var reflectedDown:Bitmap = reflect.down(length, fade, offset, blur, alpha);
reflectedDown.y = movieClipToReflect.y + movieClipToReflect.height;
addChild( reflectedDown );
The functions reflect.down(), reflect.up(), reflect.left() and reflect.right() will return a Bitmap of your object reflected in that direction. (Only the “length” parameter is required, the rest are optional.) As you…

You Might Also Like...

  • Quick Tip: How to Create Perfect Alpha Reflections

    1007 readers

  • Video: Upon Further Reflection

    537 readersCreating a Reflection Container in Flex 4, Part II, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV. This show is the sequel to the previous one, in which I showed how to create a simple container for an image and it's reflection ... that didn't look that

  • Using BitmapSplit function with Tweener

    584 readersFew posts ago I introduced Dynamic Bitmap Split Function. This function allows you to split any Bitmap into any (reasonable) number of column and rows and use those parts separately.Here is one quick example of using this function together with Tweener class. Click on image to see live example.and here is code:import flash.display.Bitmap;import flash.display.BitmapData;import flash.utils.ByteArray;import

  • A Retro TV Effect for Video and Other Dynamic Objects in AS3 Flash

    1807 readersWe present a custom AS3 class, RetroTV, that easily converts any DisplayObject, (possibly combined of Sprites, Video, Shapes, TextFields), to a retro television display. The display is complete with lines, noise, and distortion. The television

  • A Retro TV Effect for Video and Other Dynamic Objects in AS3 Flash

    595 readersWe present a custom AS3 class, RetroTV, that easily converts any DisplayObject, (possibly combined of Sprites, Video, Shapes, TextFields), to a retro television display. The display is complete with lines, noise, and distortion. The television image is updated continuously in real time to reflect changes of the object on the TV display.

  • RGB Color Channels

    Create a Retro CRT Distortion Effect Using RGB Shifting

    1726 readersIn this tutorial you’ll learn how to separate an image’s three different color channels to create an RGB shift effect. I’ll also show you some graphics tricks to mimic an old CRT display. Final Result Preview Here’s an example of the effect we’ll be creating: The main takeaway in this tutorial is going to be the RGB shifting

  • Build a Brilliant Binary Clock with Flash

    989 readersIn this tutorial we are going to create an unusual, but very cool kind of clock: a binary clock. Final Result Preview Let’s take a look at the final result we will be working towards: Step 1: What Does Binary Mean? Everyone knows how to count, but not everyone knows there are so many different ways to do so.

  • Send Season’s Greetings With a Flash Piano Christmas Card

    899 readers

  • Create a Brightness Editor in ActionScript 3

    1793 readersBrightness is an attribute of visual perception in which a source appears to be radiating or reflecting light. In this tutorial we will learn how to modify the brightness of a Display Object using ActionScript 3. Final Result Preview Let’s take a look at the final result we will be working towards: Step 1: Brief Overview Using the ColorTransform class

  • Create a Dynamic Bar Graph Generator Using XML + AS3

    1276 readers

'>How to create a top quality logo for your company
  • Remove a Section of Your Photo
  • Subscribe to RSS headline updates from: GurusUnleashed
    Powered by FeedBurner

  • Design & Career Resources

    Open design job and RFQ/RFP listings for Thursday, 29 July Courtesy of Design Jobs Live!
    The latest resources and free stuff (like textures, fonts, Photoshop brushes, scripts, plug-ins, and much more!) from workflowFreelance.com. Read more!
    The latest headlines from workflowFreelance.com. Read more!
  • Popular Search Terms

    Curious what others are searching for? Below are the most popular search terms over the last 30 days.