The new class system of MX2004 now makes it possible to create plug-ins like in Photoshop or similar applications. Of course there are components but many users hesitate to use components so here is an alternative. Macromedia already started this by creating the transitions package containing classes to create movements, tweens with and without easing. I call this new type of plug-ins Third Party Plug-ins, since these are not produced by Macromedia. I do not know how many exist already but it would probably be wise to centralize them. To locate them I created a new folder under mx called thirdparty to identify plug-in classes other than those provided by macromedia. Then I created a folder, which describes the kind of plug-in. In the following I provide information on how to place the plug-in, how to call the class and the possibilities using this plug-in. This is the first of a kind I provide on my site and others will follow.
I introduce here a plug-in called Shader. This plug-in allows creating a shadow similar to what is possible in programs like Photoshop or Fireworks. So you do not need to create a bitmap any more but you can stay within Flash. An example of what I mean is shown below.
The shader class allows to create shadows of different length, opaqueness and colors, and you can easily customize the shadow by a simple script. The one I used here is shown below.
function shading() {
_root.attachMovie("myText", "myText", 1000);
_root.myText._x = 100;
_root.myText._y = 50;
var moClip = myText;
var clipColor = null;
var shadeColor = "0x000000";
var opaque = 15;
var remove = false;
var distance = 3;
var anglex = 1;
var angley = 1;
var shad = new mx.thirdparty.onions.Shader();
shad.shade(moClip, clipColor, shadeColor, opaque, remove, distance, anglex, angley);
}
shading();
Either put your movieclip on stage or use attachMovie as shown in the example. However, there is a difference. If you attachMovie then you can place your movieclip into a higher level than the shades, which would put the shades under your movieclip and is more realistic. The arguments are as follows:
moClip is the movieclip to be shaded.
clipColor is the color of the movieclip, which can be changed by using a hex value. In this case it is set to "null", which will maintain the original colors.
shadeColor is the color of the shadows.
opaque is the alpha value of the shadow. Max is 100.
remove will remove the shadow after it was created.
distance is the length of the shadow.
anglex in combination with its counterpart angley will determine the angle of the shadow.
angley: see anglex.
You have several option. If you do not want to place the file into the mx folder, then put it into the same folder as your fla file, open the file and replace the line: class mx.thirdparty.onions.Shader { with class Shader { and correspondingly call the class from your flash movie. Otherwise do this: go to the folder Library/Application support/Macromedia/Flash MX 2004/en/Configuration/Classes/mx, into which you place the folder "thirdparty" provided here. To call the class use the path as shown above: mx.thirdparty.onions.Shader();. More plug-ins will follow for this folder. Now enjoy making shadows and if you have comments (positive or negative), suggestions or find bugs send me an email.