-->

Berita Kocar Kacir

Motivasi Menulis

A look at the Macromedia Flash 8 dropShadowFilter class with example

A look at the Macromedia Flash 8 dropShadowFilter class with example

advice
Readers that dont have Macromedia Flash 8 installed wont be able to view the source files. They were created with Flash 8. You can buy Macromedia Flash Pro 8 here, or just download a trial first. This is the latest and best version of Flash and we can do nothing else but recommend it to everybody because we absolutely love it. This new edition opens up a lot more of the magic that was already there, and it certainly is a new fresh wind for us Flash developers. Its a great investment for the future. Sorry for not having the source files available in all versions, if demand is high i will try to add more types of source files where needed?

What am i going to learn in this tutorial ?
Macromedia's Flash 8 brings us a whole new range of new goodies to play with. One of those new things is the DropShadowFilter. This filter lets you add a drop shadow to all kinds of objects in Flash. You can customize the style of the drop shadow too, so you wont have just one type of shadow. You can ofcourse also set it up in the Authoring Environment but we'll do it the actionscript way.

Lets begin
The new DropShadowFilter class is a great new way to quickly drop a shadow on an object. Before this little piece of magic we had to go through a painfully awkward process of creating the shadows in Adobe Photoshop and then trying to get it all in Flash and stil have it look good.

You can apply the DropShadowFilter on multiple types of objects. You can apply filters to movie clips, text fields, and buttons at runtime, using the filters property. You can also apply filters to BitmapData instances, using the BitmapData.applyFilter() method. And the third option is to apply filters to images and video at authoring time.

The DropShadowFilter doesn't support general scaling, rotation, and skewing. It does however support Stage scaling. Personally im not too impressed by that, but im glad they at least included that for us. If the object that has the drop shadow itself is scaled, the filter effect is not scaled with it.

Below is a quick summary of the properties you can set that will influence the look of the drop-shadow. You will have a better idea on what they will do when we start to add code.

alpha = The transparency value for the shadow color.
angle = The angle of the shadow.
blurX = The amount of horizontal blur.
blurY = The amount of vertical blur.
color = The color of the shadow.
distance = The offset distance for the shadow, in pixels.
hideObject = Indicates whether or not the object is hidden.
inner = Indicates whether or not the shadow is an inner shadow.
knockout = makes the fill transparent and reveals the document background color.
quality = The number of times you apply the filter.
strength = The strength of the spread.

Either download the source files and have a look a how i set things up or just follow along right here. Lets start by opening up Flash 8, create a file and save it as dropShadowFilter_example. There is currently one layer visible and lets rename it to 'code'. This is the layer where our all code will be, its good practice to always have your code in one place so you can spot errors quickly and fix the problem quickly too.

Ok now lets create a layer under the layer we just renamed into 'code' and name it 'square'. Select the drawing tool to draw a square and then draw one. Then select the it, press f8 and in the popup menu thats opens give it as name: 'square'. Set its registration point to 'Top Left' and if the advanced menu isnt open already, open it, and select 'export for actionscript'. We do this to let actionscript know we have created a movieClip and that its name is square. Then we can manipulate this movieclip with actionscript because it knows what 'square' is. After you pressed 'ok' select the square again and give it as name 'square' in it properties box. We are now ready to setup the dropShadowFilter via actionscript. Select the first frame in the code layer and press f9. This opens up the code editor and enables us to input our actionscript.
Labels: Program Flash

Thanks for reading A look at the Macromedia Flash 8 dropShadowFilter class with example. Please share...!

0 Komentar untuk "A look at the Macromedia Flash 8 dropShadowFilter class with example"

Back To Top