Taking advantage of a remarkable feature of Actionscript 3.0 (see ActionScript 3.0, all with the new operator ) I created a class ReflexMe able to generate an effect "reflection" on any MovieClip present in the library.
The source is part of the package undolibrary - GoogleCode of this - but if you want you can download the single file ReflexMe.as .
Utilization
Download the file ReflexMe.as and place it in the folder of your movie. fla. Select the MovieClip in the library to which you want to apply the effect reflex and open the properties window symbol. In the Linkage section ReflexMe included in base class:

At this point, feeling the movie, the MovieClip selected will have the effect of SLR. If given the MovieClip an instance name potrente also adjust parameters such as:
- reflexOffset - distance of the reflection
- gradientOffset - reflected the extension of the gradient
- alphaOffset - alpha channel of the reflection
- gradientRadial - kind of reflection: radial or linear
Notes
The class ReflexMe.as is written as a base class to extend any MovieClip. Its simplicity is such that you can riaddatarla and disarming code as "spurious" to be used by code, rather than Flash IDE. The whole effect is generated by the few (comments removed) lines of code that follow:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | / / Preserve the original large holdall of MovieClip width ; __oWidth = this. width; height ; __oHeight = this. height; / / Create a BitmapData of the large holdall / / MovieClip to which I apply the effect reflex ( this . width , this . height , true , 0x000000 ) ; __bmpd = new BitmapData (this. width, this. height, true, 0x000000); / / I copy the BitmapData on MovieClip ( this ) ; __bmpd. draw (this); / / Create a Bitmap object to display / / This will effect our SLR ( __bmpd ) ; __bmp = new Bitmap (__bmpd); / / Not see that __bmp ) ; addChild (__bmp); / / Rotate it 180 degrees: the invert = - 1 ; __bmp. scaleY = - 1; / / Position it at the base of the MovieClip oroginale / / The 2 x the height is necessary for the result of chance / / Rotation that has shifted the origin of the axes = __oHeight * 2 + __reflexOffset ; __bmp. __oHeight = y * 2 + __reflexOffset; / / Cached as a bitmap: need to cover up after / / With gradient effect and alpha channel = true ; __bmp. cacheAsBitmap = true; / / Create a mask ( ) ; __mask = new Shape (); / / Cached as a bitmap: need to cover up after / / With gradient effect and alpha channel = true ; __mask. cacheAsBitmap = true; / / Position it also reflected on the image = __oHeight + __reflexOffset ; __mask. __oHeight = y + __reflexOffset; / / Create a matrix for the gradient ( ) ; __matrix = new Matrix (); / / Create the gradient of the same size / / Original MovieClip ( __oWidth , __oHeight , Math . PI / 2 ) ; __matrix. createGradientBox (__oWidth, __oHeight, Math . PI / 2); __mask . graphics ) { with (__mask. graphics) { ; clear (); 0 , 0 , __oWidth , __oHeight ) ; drawRect (0, 0, __oWidth, __oHeight); ; endFill (); } __mask ) ; addChild (__mask); / / Set mask = __mask ; __bmp. __mask = mask; |











Hello I have tried to use this class but I get errors.
I tell you the procedure I did, so maybe you can tell me whether and where wrong.
Nuon-create a document in as3,
-Drawing a simple square, and turned it into movie clip;
-Right click on the symbol in the library, in the Linkage section ReflexMe insert in base class;
-I saved the file logically fla in the same folder where ReflexMe.as
But give me these errors:
1017-error can not find the definition of base class ReflexMe;
-5000: The class 'ReflexMe' must be a subclass of 'flash.display.MovieClip' because it is linked to a library symbol of that type;
-5001: The package name 'undolibrary.sfx' does not reflect the position of the file. Change the name of the package definition in the file or move the file. C: \ Documents and Settings \ User \ Desktop \ ReflexMe.as
What's wrong? What should I do?
I thank you in advance.
Hello!
@ Mark: if you use the file ReflexMe.as outside the library undolibrary you change the "namespace" of the package. At the beginning of the file are "undolibrary.sfx package", delete the namespace "undolibrary.sfx", with leaves only "package {" - with the clip
[...] Post Flash CS3: Create a reflex effect on any MovieClip we saw how you can write a class that extends MovieClip, to connect it to [...]
Congratulations on your wonderful website. I wanted to know if I named my movieclip instance how can I access the properties
reflexOffsetetc..Thanks
@ Linus: You can use
miaistanza.reflexOffsetto access all the properties. When you use the classReflexextend, in fact, the basic characteristics of the MovieClip. This means that the MovieClip gets all the properties and methods of theReflex.Hello to all who are reading my message. I wanted to ask some of you, if I insegnaste how to create submenus on flash cs3. I searched the internet, but I do not know how to do it. Please could you help me? My contact is: sicilianofolle@hotmail.it
expect many thanks!
@ Carlitos: exactly what you need?
@ Giovambattista Fazioli:
1017: Can not find the definition of base class SLR.
5000: The class 'ReflexMe' must be a subclass of 'flash.display.MovieClip' because it is linked to a library symbol of that type.
are the errors in an attempt help please
by alberto
@ Alberto: you must place the class SLR (spot. Pbuh) in the same folder as your. Fla
@ Giovambattista Fazioli: of course it was already positioned in the same folder as my fla.
@ Alberto: Changes the start of class:
just in:
@ Giovambattista Fazioli: I had already done the same results
Alberto in the same situation ... does not work!
That is, if you see the code reflexMe.as you posted does not say anything in embankments
In my opinion you have failed to write the article
@ Luke: No, the code and the article are not wrong. The problem is the inclusion of the library
undolibrary. Read here for detailsoh well, you said that was enough to download reflexMe.as
cm ² in the meantime I found another class that creates the reflection effect and works well even with animated MC
@ Luke: could actually be mistaken. In fact this class is based (ie, wants) on the library
undolibrary. If you already have installed, you can download only the files indicated, otherwise if you download the latest version you can find everything in the package.