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!
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!
Very cool. I look forward to using this in the future. Thank you!
Posted by
Dustin Senos |
6:58 PM
Same here, thanks man!
Posted by
Ruben |
4:47 AM
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.
Posted by
Howard |
4:41 PM
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
Posted by
Sarge |
9:46 PM
I'm trying to use this class but it doesn't work in my own code, why?
[code]
this.createEmptyMovieClip("logo_mc", 999);
loadMovie("FotoShow.swf",movie_mc);
import Reflect;
r1 = new Reflect({mc:movie_mc, alpha:85, ratio:255, distance:1, updateTime:.33, reflectionAlpha:90, reflectionDropoff:1});
r1.setBounds(549,399);
[/code]
I get no errors, but i can't see the reflection...
.:FiDo:.
Posted by
Fidoboy |
6:49 AM
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
Posted by
Sarge |
8:24 AM
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
Posted by
Tomas |
12:34 AM
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 ( 400x225 ) the reflection doesnt match the widescreen is reflects a normal screen.
Posted by
Eugene |
1:29 AM
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
Posted by
Sarge |
8:16 AM
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
Posted by
Sarge |
8:19 AM
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?
Posted by
Anonymous |
11:52 AM
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!
Posted by
Jasper |
10:43 AM
Downloading gonna check it out.... thanks
Ranjeet naidu
flash developer london
Posted by
ranjeet |
1:48 PM
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
Posted by
Anonymous |
3:51 PM
Cool thanks. Saved my brain time...hehe
Posted by
George |
11:38 PM
brillant - now just need to port it to AS3 ;)
Posted by
paddy |
8:44 AM
Nice one indeed! Just make sure you don't have any filters in the MC you are reflecting. Processor gobble!
Posted by
Peter |
7:00 AM
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.
Posted by
Peter |
12:39 PM
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
Posted by
Fabian Schwaiger |
3:57 AM
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!
Posted by
Sarge |
1:28 PM
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
Posted by
bboo |
3:49 PM
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.
Posted by
flasher |
11:58 AM
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! :)
Posted by
Sarge |
12:03 PM
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 : www.isisdemos.com/carousel
I have uploaded all the project files for your review :
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
Posted by
avijit dutta |
10:50 AM
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
Posted by
Sarge |
11:04 AM
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
Posted by
Anonymous |
5:08 AM
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
Posted by
Anonymous |
5:12 AM
just wanted to say very cool Class/project and thank you for sharing.
Cheers,
Steve
Posted by
Steve |
1:05 AM
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!
Posted by
Luca |
10:46 PM
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?
Posted by
Anonymous |
5:12 PM
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.
Posted by
Sarge |
5:43 PM
It cause a high loading of the CPU ~
Posted by
Anonymous |
10:40 PM
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?
Posted by
António |
7:24 PM
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. :-(
Posted by
natacha |
4:28 PM
Natacha - can you send me a sample FLA to test out? Thanks!
Posted by
Sarge |
6:07 PM
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
Posted by
natacha |
7:18 AM
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.
Posted by
Sarge |
8:59 AM
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?
Posted by
natacha |
12:06 PM
Natacha - yes - that is correct. The class could be easily modified to handle other situations too. Feel free to play around with it!
Posted by
Sarge |
12:09 PM
wondering is theres a way of stopping and starting the reflection from updating. so it uses less CPU. great class BTW.
Posted by
Kid Chico |
3:59 PM
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
Posted by
where_is_will |
4:53 PM
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
Posted by
W33B |
9:18 AM
w33b,
Can you send me a sample FLA to test your problem out? sgtpritchard at gmail.com Thanks.
Posted by
Sarge |
9:19 AM
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?
Posted by
Jouko |
10:22 PM
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 :).
Posted by
Sarge |
10:14 AM
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.
Posted by
j-sizzle |
11:30 PM
j-sizzle - there is an option to do that already. Set the update time to 0.
Posted by
Sarge |
8:17 AM
Aha! Should havee looked a little harder. Thx!
Posted by
j-sizzle |
6:05 PM
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?
Posted by
Özgür ALTAY |
12:48 PM
Sorry, this functionality is not currently in the class.
Posted by
Sarge |
10:21 PM
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!
Posted by
Douglas |
4:57 PM
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.
Posted by
PK |
1:41 PM
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
Posted by
oliver |
2:20 PM
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.
Posted by
Sarge |
2:39 PM
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
Posted by
pk |
5:28 PM
@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
Posted by
oliver |
10:01 AM
The way ive been doing the update is r1.updateTime:-1. I havent noticed any slow downs.
Posted by
Chris |
6:01 AM
I can one erro and need help.
The class or interface
'com.pixelfumes.Reflect' could not be loaded.
Leo
Posted by
Leotaku |
5:40 PM
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!
Posted by
Sarge |
11:54 AM
Thank you now if I me work.
Regards Leotaku (Bs As Argentina)
Posted by
Leotaku |
5:04 PM
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
Posted by
Anonymous |
4:01 PM
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.
Posted by
Sarge |
3:16 PM
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.
Posted by
LT |
4:45 PM
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.
Posted by
Sarge |
8:10 PM
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
Posted by
Dan |
9:02 AM
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?
Posted by
Benjamin |
3:48 PM
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!
Posted by
Sarge |
8:47 AM
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?
Posted by
bboyrush1234 |
5:07 PM
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?
Posted by
Sarge |
8:17 PM
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.
Posted by
mojito |
6:09 AM
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
Posted by
Marcus |
5:13 AM
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
Posted by
Sarge |
8:42 AM
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
Posted by
marcus |
10:04 AM
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.
Posted by
Sarge |
10:10 AM
Hi it's a great class...I like it.
But I would like create a Empty movie clip and riflect a external swf
I tried but unsucsfull
please help me
thanks Tony
on the timeline:
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("test.swf", mc);
Posted by
Anonymous |
6:56 PM
Hi Sarge, thanks for this grat class, I like it so much...
But I would like, if you can, the best way to apply the reflect to external swf. Can you help me?
thanks Tony
I tried with this code:
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:0, updateTime:0.33, reflectionAlpha:90, reflectionDropoff:1.85});
}
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mcLoader.loadClip("movielogo.swf", mc);
Posted by
Raziel |
6:49 AM
Tony, ensure the clip is on the same domain as you and ensure that it is completely loaded prior to invoking the reflection. It should help you out. Thanks.
Posted by
Sarge |
1:53 PM
Hi,
Through kirupa.com I came across your site and I've got a question concerning the file Reflect.as
I've got a mc with instance name 'target'. Within this mc, I've added a dynamic textfield which gets its content through a XML file.
On a second layer (called script), I've added this script:
import com.pixelfumes.Reflect;
new Reflect({mc:target, alpha:85, ratio:255, distance:1, updateTime:0.33, reflectionAlpha:90, reflectionDropoff:7});
The .as file is in the same folder as the .fla and .swf. When I test the movie, I get the following error:
The class or interface com.pixelfumes.reflect could not be loaded
Could you help me getting this to work?
Posted by
Jeff |
9:19 AM
Hi Sarge,
First of all thanks for the great coding...
The problem im facing is how much CPU it takes up, its lagging all my flash work... Is there anyway to fix this?
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 == "playing" && !r1){
r1 = new Reflect({mc:video_mc, alpha:40, ratio:255, distance:-46, updateTime:0.80, reflectionAlpha:60, reflectionDropoff:3});
update();
}
}
video_mc.video.addEventListener("stateChange", listenerObject);
^^ is the code im using?
Posted by
Anonymous |
11:20 AM
The Reflection is pretty processor intensive. I know you probably don't want a slower update time either. Your code looks good. I would just ensure that the listener is only creating 1 instance of the reflection. the code appears to do so but that is the first thing I would check.
Posted by
Sarge |
9:50 AM
I am trying to add a reflection to my coverflow classs... u mind taking a look at the fla.. cause its not work for some odd reasons
Posted by
alwayzambitious |
8:12 PM
Sure, send the fla to sgtpritchard at gmail.com
Posted by
Sarge |
8:32 PM
Thanks - It's sent so it should be in your inbox.
First I want to say that I am extremely grateful for the class.
It's saved me a day or two this week.
Now, I think my issue is that you can't reflect things that have been skewed using bitmapdate.
Is there a way around that?
Posted by
alwayzambitious |
11:08 PM
I'm not sure the last time someone commented this. But I found this class EXTREMELY useful for a project I was working on, except that I needed to have the reflection applied to a masked movieclip. I changed up the class slightly so that the reflected movieclips are added to the parent MC as opposed to the movieclip that is being masked. Swap out the top block of code for this block of code. I still need to alter it to making this an option as opposed to forcing this feature, but this should do for now until I have time. Enjoy.
var mc_c:MovieClip = args.mc;
var mc:MovieClip = mc_c._parent;
var alpha:Number = args.alpha;
var ratio:Number = args.ratio;
var updateTime:Number = args.updateTime;
var reflectionAlpha:Number = args.reflectionAlpha;
var reflectionDropoff:Number = args.reflectionDropoff;
var distance:Number = args.distance;
//class reference to reflected clip
clip = mc_c;
var mcHeight = (mc_c._height/mc_c._yscale)*100;
var mcWidth = (mc_c._width/mc_c._xscale)*100;
//
bounds = new Object();
bounds.width = mcWidth;
bounds.height = mcHeight;
//
var matrixHeight:Number;
if (reflectionDropoff<=0) {
matrixHeight = bounds.height;
} else {
matrixHeight = bounds.height/reflectionDropoff;
}
//
mcBMP = new BitmapData(bounds.width, bounds.height, true, 0xFFFFFF);
mcBMP.draw(mc_c);
//
reflectionBMP = new BitmapData(bounds.width, bounds.height, true, 0xFFFFFF);
reflectionBMP.draw(mc_c);
Posted by
Brand X |
10:29 AM
Very very nice, works perfectly in Flex on Air. many thankyous
Posted by
NakedKaf |
4:44 AM
Hi!
Is there a copyright on the reflection - class?
Where can i get information about that?
Thanks
Posted by
Trail |
3:43 PM
Hello^^
This is very cool! Now i try to use this Class in a Papervision3D Projekt but it doesent work. I think i must use a Plane as the Target Mc but it doesent work.
Can please someone tell me how to use this Class in Papervison3D ??
Thanks alot!!!
Posted by
Anonymous |
6:18 PM
Trail, there is no copyright though I would love a shoutout, commented line or link back. But none of that is really a must. Thanks for your interest.
Posted by
Ben |
7:16 PM
can anyone can plz give the best example for the FULLSCREEN in flash. ..
Posted by
PRShankar |
6:54 AM
Very nice work!!!
but i have a question : how can i reflect a dynamic text (preload count) into a movie clip ??
Thank you
Posted by
Benjamin |
10:07 PM
Ben,
You would simply nest the text field in a movie clip and then use the class on the movie clip containing the text field. That should work for you. If not, let me know.
Posted by
Ben |
10:09 PM
Very nice effect but I can not get it works for video. Can anybody help? Where can I send my fla?
Posted by
natalia |
12:26 PM
Natalia, there is a zip file at the top of the post that links to this file: http://www.pixelfumes.com/blog/mar07/Reflect%20V3.zip. In it is a demo FLA using video. Take a look and see if that helps. Make sure your video has loaded completely before trying to reflect it.
Posted by
Ben |
12:38 PM
I think I don't understand something. I use progressive dowload. Here is a code:
import com.pixelfumes.Reflect;
var nc:NetConnection=new NetConnection();
nc.connect(null);
var ns:NetStream=new NetStream(nc);
ns.setBufferTime(3);
ns.onStatus=function(info){
if (info.code=="NetStream.Buffer.Full"){
bufferClip._visible=false;
}
if (info.code=="NetStream.BufferEmpty"){
bufferClip._visible=true;
}
if (info.code=="NetStream.Play.Stop"){
ns.seek(0);
r1 = new Reflect({mc:theVideo, alpha:85, ratio:255, distance:1, updateTime:.33, reflectionAlpha:90, reflectionDropoff:7});
}
}
theVideo.attachVideo(ns);
ns.play("privet/video/flv/irena.flv");
Posted by
natalia |
3:27 PM
Natalia,
I think it was because you were trying to reflect a video symbol and not a MovieClip. Try the files here:
http://www.pixelfumes.com/blog/mar07/ReflectNS.zip
Posted by
Ben |
4:18 PM
I did exactly as you say and nothing. Can you look?
http://www.natavi.co.uk/reflect/test.zip
Thank you very much for your help.
Posted by
natalia |
2:43 AM
Hi Ben
Can you help me with this file where I use your class
http://www.natavi.co.uk/reflect/test.zip
Thank you very much.
Natalia
nata_vikh@yahoo.com
Posted by
natalia |
12:24 AM
Natalia, I sent you an updated FLA. Thanks!
Posted by
Ben |
10:06 AM
Hi! Super great class by the way..!, I just wondered if it´s possible to have two reflections (like www.nike.com) one above and one at the bottom. Is this possible?? Thanks in advance!
And again, GREAT class!
Regards
Diego
Posted by
Diego |
11:40 AM
Diego, currently the class does not support that but it could be re-written to do so fairly quickly i fyou feel up to the task.
Posted by
Ben |
9:27 PM
Hi! This is karunakar.I have loaded 16 images using xml file.I want the reflections to those images.pease send me a reply.
Thanks.
Posted by
karunakar |
4:03 AM