Reflection Class V3 with Source

I was prompted today to update my Reflection Class. Many of you have posted updates and revisions of the class and I thank you all for that. I took some of the revisions and officially updated the class. The new class now supports clips that change their position. The old code would not allow an object to change the x position. This is now handled by telling the class how large of an area of a given clip should be monitored and reflected. View the demo below:

You can try the new class out below using the sliders to update the properties assigned. Once you have a look you like you can copy the code below for reference when using the class.

You can download the source and demos here.Thanks to Mim, Jasper, Jason and anyone else who has been using/modifying the code!

107 Responses to “Reflection Class V3 with Source”

  1. Dustin Senos Says:

    Very cool. I look forward to using this in the future. Thank you!

  2. Ruben Says:

    Same here, thanks man!

  3. Howard Says:

    This is really cool! Was wondering if it would work with any Movie Clip or does it have to be a video? A sample code would be nice if it can be done.

  4. Sarge Says:

    Howard – the code can be used with any movie clip. Just download the .as file, create a new FLA file co-located to the .as file (same directory) and paste this code into an empty frame:

    import com.pixelfumes.Reflect;
    new Reflect({mc:video_mc, alpha:85, ratio:255, distance:1, updateTime:0.33, reflectionAlpha:90, reflectionDropoff:7});

    this assumes you have an instance name of video_mc on your movie clip – if it is different swap that out for the instance name on your movie clip.

    Hope this helps!
    -Sarge

  5. Fidoboy Says:

    I’m trying to use this class but it doesn’t work in my own code, why?

    <br/><br/>this.createEmptyMovieClip("logo_mc", 999);<br/>loadMovie("FotoShow.swf",movie_mc);<br/><br/>import Reflect;<br/>r1 = new Reflect({mc:movie_mc, alpha:85, ratio:255, distance:1, updateTime:.33, reflectionAlpha:90, reflectionDropoff:1});<br/>r1.setBounds(549,399);<br/><br/>

    I get no errors, but i can’t see the reflection…

    .:FiDo:.

  6. Sarge Says:

    Fido, my guess is that the reflection is processing before the clip is loaded that you are loading with the loadMovie call. Preload that clip and ensure it is 100% loaded, once that is true, then apply the Reflect. Send me an FLA if you still have problems. Thanks.
    -Sarge

  7. Tomas Says:

    Hi, thanks for the class, very cool. The class works when symbols are contained in the flash, but when you use createEmptyMovieClip fails.

    I ve been trying to use it with this code and have been unsuccessful:

    import com.pixelfumes.Reflect;
    var container:MovieClip = _root.createEmptyMovieClip(“container”, getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(this);
    mcLoader.loadClip(“logo.jpg”, container);

    function onLoadComplete(mc:MovieClip) {
    new Reflect({mc:mc, alpha:85, ratio:255, distance:1, updateTime:0.33, reflectionAlpha:90, reflectionDropoff:4});
    trace(“onLoadComplete: ” + mc);
    }

    If u have the solution it would be great.

    Thanks,

    Tomas

  8. Eugene Says:

    Thanks for the cool code! Your recent AS makes it so easy to use however I have problem getting it to work with a FLV set to widescreen 16:9. When I set the the FLV component’s path to import to my widescreen FLV ( 400×225 ) the reflection doesnt match the widescreen is reflects a normal screen.

  9. Sarge Says:

    Tomas,
    The class does support “createEmptyMovieClip”. The problem is the movieclipLoader onComplete event. It fires before the first frame is executed so you are reflecting a blank clip. Use onLoadInit instead. The following code worked fine for me:

    import com.pixelfumes.Reflect;
    var loadListener:Object = new Object();

    loadListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number):Void {
    r = new Reflect({mc:target_mc, alpha:85, ratio:255, distance:1, updateTime:0.33, reflectionAlpha:90, reflectionDropoff:4});
    }

    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(loadListener);

    var mc:MovieClip = this.createEmptyMovieClip(“mc”, this.getNextHighestDepth());
    mcLoader.loadClip(“logo.jpg”, mc);

    Hope that helps!
    -Sarge

  10. Sarge Says:

    Eugene,
    Sounds like the reflection is firing before the FLV component has updated its size. I always wait until the video is completely loaded in my FLV e.g.:

    //don’ apply effect to video until it is loaded
    import mx.video.*;
    var listenerObject:Object = new Object();
    listenerObject.stateChange = function(eventObject:Object):Void {
    if(video_mc.video.state == “stopped” && !r1){
    r1 = new Reflect({mc:video_mc, alpha:85, ratio:255, distance:1, updateTime:.33, reflectionAlpha:90, reflectionDropoff:7});
    update();
    }
    }
    video_mc.video.addEventListener(“stateChange”, listenerObject);

    If this doesn’t help feel free to email me the FLA and I will take a look. Thanks!
    -Sarge

  11. Anonymous Says:

    Why is it when I scroll the page, the flash player freaks out,stutters and stops? It does this for youtube and soapbox as well. But not for stage6 or wmp based services. Could that be fixed?

  12. Jasper Says:

    Very nice to see you made an update including my adjustments. End offcourse all the others, looks very smooth now. Final version ;)

    I got one more idea. to mask the reflection, but that’s a personal project and maby an option for later on.

    Good work guys!

  13. ranjeet Says:

    Downloading gonna check it out…. thanks

    Ranjeet naidu
    flash developer london

  14. Anonymous Says:

    this is great! but i’m having a problem with the reflection not showing up until either the entire movie plays or i drag the time slider to the end of the time bar……

    Is there any way to ALWAYS keep the reflection on? Here’s my code

    import com.pixelfumes.Reflect;

    //don’ apply effect to video until it is loaded
    import mx.video.*;
    var listenerObject:Object = new Object();
    listenerObject.stateChange = function(eventObject:Object):Void {
    if(video_mc.video.state == “stopped” && !r1){
    r1 = new Reflect({mc:video_mc, alpha:50, ratio:255, distance:0, updateTime:.33, reflectionAlpha:64, reflectionDropoff:3});
    update();
    }
    }
    video_mc.video.addEventListener(“stateChange”, listenerObject);

    Thanks!
    Jim

  15. George Says:

    Cool thanks. Saved my brain time…hehe

  16. paddy Says:

    brillant – now just need to port it to AS3 ;)

  17. Peter Says:

    Nice one indeed! Just make sure you don’t have any filters in the MC you are reflecting. Processor gobble!

  18. Peter Says:

    Is there anyway that you can setBounds for a certain height at the bottom of the movieclip to be reflected, rather than the top? Using a largish video gets sluggish when you setBounds for the whole video movieClip. If you could define only the bottom 70 or so to reflect then I would assume this would enable better performance.

  19. Fabian Schwaiger Says:

    This Code is still ActionScript 2.0 right ?
    Is it possible to change it to 3.0 ?
    It does not really work with 3.0
    Thanks

  20. Sarge Says:

    There is an old AS3 version here:
    http://pixelfumes.blogspot.com/2006/06/actionscript-3-reflection-class-source.html

    The new AS3 version is complete and will be posted within the next few weeks through Adobe.com hopefully.

    Thanks!

  21. bboo Says:

    Problem: I have absolutely no idea about flash. I have my viewer.swf script for my gallery (from airtightinteractive.com) and want to import the swf into a new swf, in witch I will put the reflection under the viewer.sfw. Undestood? :)

    I tried to handle all the loadMovie and stuff, but still nothing is working, becouse I don’t know how to use holders, mc’s etc…
    I think it should be veryvery easy for someone with just a little knowledge. :)

    Can u help me please?

    Thanks a lot

    bboo

  22. flasher Says:

    hi.
    your class is very nice. but I have a quesitons about it.

    when I reflect a movieclip button, the reflected movieclip can click too, How can I disable the reflected movieclip buttn.Thanks.

  23. Sarge Says:

    The best way to do what you are trying to achieve is to create a nested clip or button within the movieclip that you are reflecting and use it to handle the click event vs. using the entire clip you are reflecting to do so. You can also modify the class if you desire to make it do whatever you like! :)

  24. avijit dutta Says:

    Hi, Ben Pritchard

    We are developing an dynamic animated image gallery with xml using Flash

    8 & AS2, for which the images are called up from a different domain. I

    have used the reflection class to achieve reflections. This works fine

    when the images are called from the same domain. But, when the images are

    called from another domain, the reflection class does not work. Although

    the images are showing up. Please review the link provided. You will see

    2 images that have the reflection working, these images are called from

    the local domain. The other images are have a cross domain link. I also

    need to mention that even on the local domain the refection functionality

    is irratic.
    The same file works correctly in the flash application environment, even

    for the cross domain images, but when it is published in html page, it

    malfunctions.

    The link to view the animation please go to : http://www.isisdemos.com/carousel
    I have uploaded all the project files for your review :

    http://www.isisdemos.com/carousel/carousel.zip

    I would really grateful if you could take the time and review this

    problem, as I have been trying this for the last few days with little

    success.

    Thank you in advance.

    Avijit Dutta

  25. Sarge Says:

    Avijit,
    Have you tried not applying the class to the clip until after the external image has loaded? Either that or apply an update time to the clip.
    -Ben

  26. Anonymous Says:

    Hi and thanks for your class is soo cool ;)
    i need help because using the reflect class i got this error message: ArgumentError: Error #2015: BitmapData not valid.
    why?
    thx

  27. Anonymous Says:

    Hi and thanks for the class.
    i need help because using this class i got this error message: ArgumentError: Error #2015: BitmapData not valid.
    why? thx

  28. Steve Says:

    just wanted to say very cool Class/project and thank you for sharing.

    Cheers,
    Steve

  29. Luca Says:

    hi sarge i’m Luca, you redirect me here from the old reflect class post :)
    this new version is really cool, now supports the alpha chan of png and gif images…great! thanks a lot!
    i’ve a question for you:
    is possible to cover a reflection of one item with another one?
    I found very difficult the solving of this problem: here you can find a very simple example of what i’m talkin about…
    http://img134.imageshack.us/img134/6674/examplepc5.jpg
    one mc and another one, on two different layers. the reflection of the mc behind pass through the other :(
    as always thanks a lot for everything.
    bye!

  30. Anonymous Says:

    something very weird going on for me I just get a reflection of the top right quarter of my mc and this only appears a long way down from the mc. But if i use your box_mc with the same code it works fine which tells me the codes are cool but its a mc problem…….very odd…….any ideas?

  31. Sarge Says:

    Anonymous,
    Check to ensure your movieclip is registered at 0x and 0y. Also check that the mc you are reflecting is not scaled – it must be 100%. The items within the mc however, may be scaled.

  32. Anonymous Says:

    It cause a high loading of the CPU ~

  33. António Says:

    Awesome work, I really have to thank you for this.

    But I’m having a little flickr sometimes when using this while loading the swf to a movieclip.

    anyone had the same problem or have any idea why this happens?

  34. natacha Says:

    I have been successfully using this awesome class – many thanks!
    I do run into a problem though, if the reflected movieclip has several frames inside or if there is a tween inside the movieclip. Is this expected and do you know of a workaround? I tried creating a nested clip that contained the tweens but that did not work. I always place the script outside the clip at frame 1. Placing it in the clip’s onClipEvent(load) { } event also did not work. :-(

  35. Sarge Says:

    Natacha – can you send me a sample FLA to test out? Thanks!

  36. natacha Says:

    Hello Sarge,

    I have uploaded a sample zip (flash CS3 file) here:

    http://www.buildingblock.com.au/reflect_sample_code.zip

    The video layer works.
    (remove the guide setting on the layer to review)

    The image layer does not work.
    I thought it was if there was a tween in the clip, but I have reproduced the problem with this (seemingly) basic movieclip.

    Thanks again.
    Natacha

  37. Sarge Says:

    Natacha – I figured it out. Check the zip out here:
    http://www.pixelfumes.com/blog/aug07/refNatacha.zip

    Check out the jpg screenshot in there for an explanation. Basically your image was “group masked”. Take a look.

  38. natacha Says:

    Thanks very much for taking the time to check out the problem – I am always amazed at the open source community out there and where you guys find the time :-P

    So from your response I take it I cannot mask a larger image then reflect that clip? (even by nesting this clip within other movieclips?

    The reason I was using the large image is that this was in a nested clip that had tweening (ie the large image pans slowly from left to right).

    So I take it that it is not possible to reflect a clip that contains an animation contained within a masked area?

  39. Sarge Says:

    Natacha – yes – that is correct. The class could be easily modified to handle other situations too. Feel free to play around with it!

  40. Kid Chico Says:

    wondering is theres a way of stopping and starting the reflection from updating. so it uses less CPU. great class BTW.

  41. where_is_will Says:

    Hi,

    I am sure this is all a little old to you now, but I have used the class in a basic way before and loved the results, so I hope you can help. I have a very simple xml slideshow (just fading images) running into an empty movie clip. When I try to reflect the imageLoader clip it fails, I assume because the clip is reflecting before the images load into it?

    I read comments with your advice to preload, but being a bit of a muppet with AS2, or indeed 3, at this stage, I have struggled with linking the preload to the class.

    I am back to the very basic stage at the moment, code is;

    imageLoader.loadMovie(“slideshow_as.swf”);
    import com.pixelfumes.Reflect;
    r1 = new Reflect({mc:imageLoader, alpha:85, ratio:255, distance:1, updateTime:.33, reflectionAlpha:90, reflectionDropoff:1});
    r1.setBounds(480,imageLoader._height);

    Which of course doesn’t work! Any advice would be great.

    Cheers,

    Will

  42. W33B Says:

    I love this class!

    But, I have a problem….

    I’m dynamically adding FLVPlayback complonents in to an mc that is being reflected. when I do, the reflection stops working.

    If I use a video symbol instead, then I get the reflection. However I don’t want to use this as I am using other playback components and don’t fancy the idea of writing these from scratch.

    any help greatly appreciated!

    w33b

  43. Sarge Says:

    w33b,
    Can you send me a sample FLA to test your problem out? sgtpritchard at gmail.com Thanks.

  44. Jouko Says:

    Thanks so much, I love it when smart people can help me out. Designing is one thing, but coding hurts my brain.

    One question, is there any way to skew the reflection, or to put some perspective into it?

  45. Sarge Says:

    There are ways to skew the reflection using Matrix Transforms. I have some stuff I worked on here but nothing ready for release. Back in the day someone had done it with an old version of this class. Maybe someone will take it upon themselves to add the functionality :) .

  46. j-sizzle Says:

    I had to remove this from a website I am launching tonight due to very high CPU usage. Not so bad in IE, but Firefox will crawl to a stop when reflecting about 15 movieclips. It has to be due to the interval. An option to turn that off would be great.

  47. Sarge Says:

    j-sizzle – there is an option to do that already. Set the update time to 0.

  48. j-sizzle Says:

    Aha! Should havee looked a little harder. Thx!

  49. Özgür ALTAY Says:

    This is great!

    I am using a class named: AFC_Reflection But your class is more robust than this.

    There is a problem with that class; when my movie moves up, I have to chance the reflection distance manually…

    Does your class can handle it or works as the same with AFC_reflection class?

  50. Sarge Says:

    Sorry, this functionality is not currently in the class.

  51. Douglas Says:

    Nice work!

    If the registration point of the movie clip is not 0,0 the reflection doesn’t work. Do you have any sugestion?

    Thanks!

  52. PK Says:

    Regarding turning off reflection updating: In a previous post the solution was to set updateTime = 0.

    I’m doing this and it’s not working. What am I doing wrong?

    r1 = new Reflect({mc:maincontent, alpha:35, ratio:27.3, distance:0, updateTime:1, reflectionAlpha:100, reflectionDropoff:0});

    and further down the timeline, when I want to stop updating, I do this:
    r1.updateTime = 0

    Reflection keeps updating and eating CPU.

  53. oliver Says:

    Hi!
    I’m developing a gallery using AS2 and have used your fantastic reflection class to achieve mirroring.
    It works fine, when I use the correct URL (http://www.mydomain.com). But when I try to call the images from a sub-domain (http://pictures.mydomain.com) or from a incomplete URL (http://mydomain.com) the reflection does not appear. I put a crossdomain.xml to the root of the server but it didn’t work.
    System.security.loadPolicyFile script also placed in the code.
    Any idea what’s the problem?

    Cheers!
    oliver
    email4you{at}email{dot}de

  54. Sarge Says:

    oliver,
    I don’t have much experience with cross domain policies but that would be my first guess – especially if through the IDE you get errors saying such. Otherwise is it potentially a pathing issue? Sorry to be of so little help.

  55. pk Says:

    Oliver, you need a cross domain policy file on the server from which you are loading the image you want to apply the reflection to. Adobe does not allow bitmap data operations on images loaded from other domains unless the policy file is there and is loaded ahead of time.

    http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000353.html

  56. oliver Says:

    @sarge, @pk
    Thanks for your reply!
    @pk I added a crossdomain.xml to the server but I have still the same problems. I’m using ActionScript 2 but the sample is for ActionScript 3. I’m at my wits’ end ;-)

    Cheers!
    oliver
    email4you{at}email{dot}de

  57. Chris Says:

    The way ive been doing the update is r1.updateTime:-1. I havent noticed any slow downs.

  58. Leotaku Says:

    I can one erro and need help.
    The class or interface

    ‘com.pixelfumes.Reflect’ could not be loaded.

    Leo

  59. Sarge Says:

    Leotaku, please ensure that you have the Reflect.as file nested in the proper directory structure and co-located to your FLA file. For example, the Reflect.as file needs to be nested in a com > pixelfumes folder. If you download the example files and extract them while maintaining the directory structure everything should be in the correct place. Thanks!

  60. Leotaku Says:

    Thank you now if I me work.
    Regards Leotaku (Bs As Argentina)

  61. Anonymous Says:

    first off let me say…cool!

    I want to reflect all…not only one movie.

    Is it possible to reflect a movie with movies inside?

    gr. LT

  62. Sarge Says:

    LT, you can create multiple instances of the Reflect class for each individual movie clip (e.g. r1, r2, etc). The simplest way would be to nest each clip to be reflected into one parent clip and then just have one reflect on the parent clip thus reflecting all of the clips inside as well. Either way would work.

  63. LT Says:

    proberly I did something wrong..It works now. Thnx voor de quick reply.

    I tried putting the update to 0 but its still running heavy. On my own comp. it runs oke but when I test it on a P4 motion tweens are running very slow etc. CPu at 60/70%
    I am not reflection a video…

    Is there a solution to fix this.

  64. Sarge Says:

    LT, 0 would actually be the fastest update time you could use and thus the most processor intensive. A higher time will sample the reflection less often and improve performance. An update time of -1 will not update the clip at all and will have the lowest CPU usage.

  65. Dan Says:

    As in another post comment stated I’ve modified this class a little bit to support a blur effect. Additionally the reflection will be send down to the lowest depth in the container so all your items keep in front of it. This is useful for distance < 0.
    Furthermore I cleaned up the code to prevent warnings in the FDT. :-)

    my blog posting

  66. Benjamin Says:

    I am loading pictures from an xml file via a loop. What is the best way to use this class to get a reflection on the dynamically loaded pictures?

  67. Sarge Says:

    Ben,
    Apply the reflections to each picture after the load of each picture is complete – only then. One other option is to load the pictures into a parent clip and simply reflect only the parent clip – again, you may need to wait until all assets are loaded before trying to reflect anything. Hope this helps!

  68. bboyrush1234 Says:

    hi, great class first off. I want to know if there is anyway to reflect more then one movieClip, without copying the code over and over. is there a way that i can tell the class to reflect multiple movieClips?

  69. Sarge Says:

    bboyrush1234, the simplest down and dirty way to do that would to be to nest all clips you wish to reflect into a wrapper clip then simply reflect the wrapper – make sense?

  70. mojito Says:

    I had problems when using this class with flickering in firefox and opera on pc. I’m going to look into what was causing this, just wanted to alert the developers out there that if they have flickering and strange rendering behaviour in firefox and opera on pc then try removing this class. I like the effect and will do my best to get to the root problem.

  71. Marcus Says:

    Hi,

    at first very cool class!

    I have the refelction working fine on PC! But on my Mac neither with Safari nor Firefox the reflection is shown?!

    Is there a known Problem in some constellations that the reflection is not shown on a Mac (Safari/Firefox)?

    regards marcus

  72. Sarge Says:

    Marcus, it shouldn’t matter. I would make sure that you have Flash 8 or higher installed in your other browsers (Flash 9 if using the AS3 version) If you still have problems you can email me your FLA at sgtpritchard at gmail.com

  73. marcus Says:

    Hi sarge,

    thanks for your quick reply.

    I just found out what was wrong.

    Due to design and the image I wanted to reflect, I have to change the x-position of the reflection.

    Shame on me … I tried some changes on reflectionBMP.x value in line 71, which worked well for the PC but crashed on my mac…don’t know why?!

    Is there a save way to adjust the x-position of the reflection relative to the image.

    Thanks in advance and
    kind regards
    marcus

  74. Sarge Says:

    Marcus, yes you can do so. You can either modify the Reflect class or do it after the fact by targeting the nested items that are created by the class. You will likely have to open the class and find what it is you wish to move. There is currently no method to do so built into the class.

  75. Spa Says:

    Hi Sarge,
    Thanks a ton for making this available. I plan to use it on a new project.

    While doing some preliminary testing I noticed that the reflection was off by a pixel or two when applying it to a MC containing vector art and/or a bitmap. My guess is that some of the math causes the numbers to drift. I’ve experienced this before due to floating point calcs I think. As a quick-fix I modified the following lines in your object code:

    From:
    Line #22: var mcHeight = (mc._height/mc._yscale)*100;
    Line #23: var mcWidth = (mc._width/mc._xscale)*100;

    To:
    Line #22: var mcHeight = Math.ceil((mc._height/mc._yscale)*100);
    Line #23: var mcWidth = Math.ceil((mc._width/mc._xscale)*100);

    It seems to work well. The reflections are spot on now, but I’m worried that it may have some other impact that I’m not aware of. Do you have any feedback or cautions against me doing this?

    Thanks!
    .spa

  76. admin Says:

    Spa – that looks good. Test ‘er out and let me know what you get. I would imagine the additional calculations would have some overhead but I am sure that it will likely be minimal.

  77. dino Says:

    hi, i try to see your reflect code and fla. very intresting, but i need to have same indication. i try to import a new video on the fla example, but i can’t understand why doesn’t work….there are some specific way to import a video? thanks a lot, dino

  78. Ben Says:

    Dino, send me your FLA and video to sgtpritchard at gmail.com and I will take a look. Thanks!

  79. dino Says:

    i sent a fla and video thanks a lot :)

  80. Dahs Says:

    http://www.mediabarninc.com/creative/portfolio.html

    In Firefox (PC only) the first thumbnail reflection is flickering. It’s more substantial on older machines but prevalent in all I’ve tested.

    Any suggestions on what I may do?

    Thanks,
    Dahs

  81. Ben Says:

    Dahs, I took a look in Safari and Firefox Mac and Firefox PC. It looked good in all of them. I think it flickered once or so on the Firefox PC but I couldn’t reproduce every time. It may have been a figment of my imagination. I thought it looked really good.

  82. forby Says:

    I’m having the same problem as mojito. For some reason in firefox and opera, the movieclip reflected by the class flickers and jitters all crazy like. haven’t yet been able to fix it, besides just removing it.

    But when viewing this page in firefox, your videos and images reflect fine. So i guess it’s an implementation problem on my end. maybe when other masks are involved outside or inside the reflected object? anyone else having this problem?

  83. forby Says:

    ah, just saw the more recent comments. woops. so i’m not the only one. i’ll keep workin on it.

  84. PK Says:

    Looks great. I just feel like an idiot because I can’t get it to work on the simplest movieclip.. Help!

  85. Ben Says:

    PK, send me the FLA of what you are trying to do.

  86. carlo veltri Says:

    Hi… i’m really “tabu” on action scriping so…
    how can i add your class to a text animation make with “txeff”?
    Please… help me!

  87. carlo veltri Says:

    i don’t know action scripting… how can i implement this class to a txeff text?
    Please help me!

  88. koko Says:

    Hello, I think my question is going to be too late issue!?

    your as is really great, it worked for one MC, but second MC did’t.

    Both mcs’ are on the same scene, but different MC and different instance name.

    And also I tried to load MC, but it did’t work.

    Please help me….

  89. Ben Says:

    Koko, send me your FLA and I will take a look. sgtpritchard at gmail.com

  90. Flash: where to begin? | Pjetr.be Says:

    [...] Tweener: http://code.google.com/p/tweener/ Reflect: http://blog.pixelfumes.com/?p=152 [...]

  91. Towel Says:

    This is a great class, thanks a lot for making it available.

    2 questions…
    1 – For some reason I cannot get the reflection to display on my external swfs when they are over approx 300kb. On smaller loaded swfs it works fine. It is a fairly image heavy site so swfs of this size (containing several images) cannot really be avoided. Any ideas?

    2 – I wish to have a main page title below the images which currently gets covered by the reflection. Is there a way to make this title mc always above the reflection. I have had a play with swapping depths but with no success.

    Many thanks in advance.

  92. akshay Says:

    @towel

    have you tried putting text on adjusting layers?means text layer should be on the top that might could help you

  93. akshay Says:

    ben i am having troubles using xml images and pixelfumes over image preloading….can you please help i have comment on your blogspot blog

    thanks in advance

  94. Ben Says:

    akshay, send me your FLA at sgtpritchard at gmail.com and I will have a look.

  95. Chris Says:

    Awesome class – strange issue: creating an reflect instance somehow kills all my events. Here’s my code:

    function createReflection() : void
    {
    for ( var i : Number = 0; i < mcAllProducts.numChildren; i++ )
    {
    var mcProducts : MovieClip = mcAllProducts.getChildAt( i ) as MovieClip;
    var mcImages : MovieClip = mcProducts.mcImages;
    var reflection:Reflect = new Reflect( { mc : mcImages, alpha : 50, ratio : 50, distance : -5, updateTime : 0, reflectionDropoff : 0 } );
    }
    }

    if I comment out the reflection line, all is fine. If I apply the reflection, I get no more events. Thoughts?

  96. Chris Says:

    weird – rearranging the layer order in Flash solved the issue. I moved the reflected mc’s under the even-firing mc’s. without reflection, it didn’t matter, but with it, no events.

  97. Chris Says:

    I have not really be able to get this class to work, partly because I’m just really getting a hang on actionscript 3.0, so perhaps I’m doing something wrong with your class but basically I get nothing when I make a box on my stage convert it to a movie clip then insert your code to make a reflection under it. Now I know this is a simple thing but again im just getting started so taking baby steps before using more advanced properties and methods with your class but hopefully you can tell me why no reflection shows when the code is set up like this:

    import com.pixelfumes.reflect.*;

    var r1 = new Reflect({mc:box_mc, alpha:50, ratio:100, distance:0, updateTime:-1, reflectionDropoff:0});

    now if i change the ratio to 255 it shows a reflection but way off center and below. Is there any other documentation or examples you have somewhere I can pick through and try to help get a grasp on using this?

  98. Chris Griffith Says:

    Ben-

    Did you ever address the issue of not having the source placed at 0,0? Was playing with the new 3D effects and needed to have the image set with a registration point in the center, upon doing so I lost the reflection.

    I did find a work around, if I nest the image inside another clip with it’s registration in the center and set the image back to 0,0) the reflection will work and the image properly rotate.

  99. Jeff Says:

    Hey Chris,

    I am trying to do the same thing here. I am using gotoAndLearn’s 3D Video flip script and I’m trying to apply this Reflection to it. I basicaly did the same workaround except for me, the reflection is way at the bottom away from my mc. How come the reflection is not right at the bottom of my MC it’s starting to drive me crazy!

  100. Ming Says:

    Hi, I have my flv reflecting nicely, but it has choppy audio when I run it online, and also through Simulate Download. When I disable the reflect script the audio is fine. Any ideas?

  101. Ben Says:

    Try changing the update time.

  102. Flash Actionscript 3 Reflection Class Fix | NewSourceMedia Blog Says:

    [...] You can download the latest Actionscript 3 Reflection Class here [...]

  103. denza Says:

    hi, I try to reflect image – but reflection is not smooth – would you fix it? It`s just few params in attacheBitmap

  104. Ben Says:

    There is nothing to fix. Feel free to modify the class to fit your needs and try changing the update time to null if you don’t need the reflection to update. There is also an AS3 version here: http://www.adobe.com/devnet/flash/articles/reflect_class_as3.html

  105. emkay Says:

    This is extremely handy, however would it be possible to add a blur effect to the reflection to give it that extra depth and realism?

  106. Jim Says:

    Hi, I keep getting this error.
    An ActionScript file must have at least one externally visible definition

    What’s it mean ?

  107. mario Says:

    hi there, thanks for this great script. i use it to reflect a kind of turn-around-animation. works great, but the reflections turns in the wrong direction. what’s wrong, any ideas?
    http://kunden.schattenwerk.ch/reflect/

    thx!

Leave a Reply