|  | direct pixel access on MovieClips | AS2.0. |  | |
| | | terablade2001 |  |
| Posted: Sat Jun 28, 2008 11:47 am Post subject: direct pixel access on MovieClips | AS2.0. |  |
| |  | |
How can anyone read and change the RGBA pixel values of MovieClips in AS2.0? This question comes up, when we need to apply self coded filters on a MovieClip.
For example I want to make a MovieClip to appear mirrored and it's pixels to change their alpha from 100 to 0, from the top side to down. As far as I know all Flash filters are applied to the whole MovieClip. Thus I guess the only way is to make a function that will take the pixels RGBA values and their positions relative to the origin of the MovieClip instance and change dynamic their values. This technique is used in many Photos presentations as far as I have seen, where the photo is apperead as mirrored and gradient-faded.
In another case I want a dynamic Fish-Eye filter to be applied to panoramic moving image, giving in that way the sense of depth to the viewer. In order to do that I have to know the XY-RGBA (A for Alpha) values of each pixel, and to be able to change them dynamically on runtime.
Anyone that can help?... Thanks. |
| |
| | | kglad |  |
| Posted: Sat Jun 28, 2008 2:13 pm Post subject: Re: direct pixel access on MovieClips | AS2.0. |  |
| you can use the bitmapdata class for pixel-by-pixel control. (but for simple mirror images you can simply use duplicatemovieclip, scaling and alpha to achieve the desired effect.) |
| |
| | | terablade2001 |  |
| Posted: Sat Jun 28, 2008 2:22 pm Post subject: Re: direct pixel access on MovieClips | AS2.0. |  |
Thank you for replying.
Two questions: A) The BitmapData class is used only for Bitmap Images, or it can be used for "vector" images/graphics (like those of Flash / Illustrator)? B) Is there any way to create gradient alpha effects (not just alpha change)? I mean, the left side of the Object to me normal, and the right side to be totally transparent (alpha=0), while in middle alpha=50. |
| |
| | | kglad |  |
| Posted: Sat Jun 28, 2008 2:36 pm Post subject: Re: direct pixel access on MovieClips | AS2.0. |  |
A) you can use any movieclip to create a bitmapdata instance using the draw() method.
B) yes, check the beginGradientFill method of the graphics class. |
| |
| | | clbeech |  |
| Posted: Sat Jun 28, 2008 2:41 pm Post subject: Re: direct pixel access on MovieClips | AS2.0. |  |
a) yes only for bitmap image data - however you can 'draw' any on stage clip into a BitmapData object. Then you can attachBitmap using the Bitmap data object to the current clip.
b) yes - in the colors pallet if you have applied a gradient, you can select any of the color points on the bar and reduce the alpha by any amount.
However, if you are planning on using this for the 'mirror' effect - you will need to create a mc that 'overlays' the newly created mirror image clip and then use it to mask the mirror - remember that when using a alpha based mask both the mask and the maskee need to have their 'cacheAsBitmap' properties set to true. |
| |
| | | terablade2001 |  |
| Posted: Sat Jun 28, 2008 3:08 pm Post subject: Re: direct pixel access on MovieClips | AS2.0. |  |
Thank you guys.
I have to read much stuff about BitmapData and do some experiments to learn how to use it the way I way.
As for the mirror case, getting an idea of you I googled the correct words and found a nice tutorial (worked!) which I appose: LINK
Thank you. |
| |
| | | terablade2001 |  |
| Posted: Sat Jun 28, 2008 3:10 pm Post subject: Re: direct pixel access on MovieClips | AS2.0. |  |
:beer; (Checking the "This question has been answered")  |
| |
| | | kglad |  |
| Posted: Sat Jun 28, 2008 5:28 pm Post subject: Re: direct pixel access on MovieClips | AS2.0. |  |
| |
|
|