View comments | RSS feed

DropShadowFilter (flash.filters.DropShadowFilter)


Object
    |
    +-flash.filters.BitmapFilter
        |
        +-flash.filters.DropShadowFilter

public class DropShadowFilter
extends BitmapFilter

The DropShadowFilter class lets you add a drop shadow to a variety of objects in Flash. You have several options for the style of the drop shadow, including inner or outer shadow and knockout mode.

The use of filters depends on the object to which you apply the filter:

You can also apply filter effects to images and video at authoring time. For more information, see your authoring documentation.

If you apply a filter to a movie clip or button, the cacheAsBitmap property of the movie clip or button is set to true. If you clear all filters, the original value of cacheAsBitmap is restored.

This filter supports Stage scaling. However, general scaling, rotation, and skewing are not supported. If the object itself is scaled (if _xscale and _yscale are not 100%), the filter effect is not scaled. It is scaled only when the Stage is zoomed in.

A filter is not applied if the resulting image exceeds 2880 pixels in width or height. For example, if you zoom in on a large movie clip with a filter applied, the filter is turned off if the resulting image exceeds the limit of 2880 pixels.

Availability: ActionScript 1.0; Flash Player 8

See also

filters (MovieClip.filters property), cacheAsBitmap (MovieClip.cacheAsBitmap property), filters (Button.filters property), cacheAsBitmap (Button.cacheAsBitmap property), filters (TextField.filters property), applyFilter (BitmapData.applyFilter method)

Property summary

Modifiers

Property

Description

 

alpha:Number

The alpha transparency value for the shadow color.

 

angle:Number

The angle of the shadow.

 

blurX:Number

The amount of horizontal blur.

 

blurY:Number

The amount of vertical blur.

 

color:Number

The color of the shadow.

 

distance:Number

The offset distance for the shadow, in pixels.

 

hideObject:Boolean

Indicates whether or not the object is hidden.

 

inner:Boolean

Indicates whether or not the shadow is an inner shadow.

 

knockout:Boolean

Applies a knockout effect (true), which effectively makes the object's fill transparent and reveals the background color of the document.

 

quality:Number

The number of times to apply the filter.

 

strength:Number

The strength of the imprint or spread.

Properties inherited from class Object

constructor, __proto__, prototype, __resolve


Constructor summary

Signature

Description

DropShadowFilter([distance:Number], [angle:Number], [color:Number], [alpha:Number], [blurX:Number], [blurY:Number], [strength:Number], [quality:Number], [inner:Boolean], [knockout:Boolean], [hideObject:Boolean])

Creates a new DropShadowFilter instance with the specified parameters.

Method summary

Modifiers

Signature

Description

 

clone() : DropShadowFilter

Returns a copy of this filter object.

Methods inherited from class BitmapFilter

clone


Methods inherited from class Object

addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch



Version 8

Comments


No screen name said on Sep 23, 2005 at 12:37 PM :
Please note:
It seems like the argument "hide object" is only used if "knockout" is set to false.
Regards, B.
BryanTheCrow said on Jan 7, 2006 at 9:13 PM :
Anyone have any luck figuring out a way to instantiate this object in an FLA that can be compiled for both flash 7 & 8? I'd like to use 1 swf & support both versions, but compiling for flash 8 renders all symbols in the library unusable for the version 7 player, and compling for 7 causes the line where this object is instantiated to crash...
Kevin Sweeney said on Feb 14, 2006 at 11:31 PM :
Bryan,

The BitmapFilter effects are available only for Flash 8, so you will have to export your SWF for versions 8 and above. Sorry.

On a seperate note, does anyone have any idea why a dynamically created movie clip that has a drop shadow filter attached via Actionscript doesn't overlap another dynamically created movie clip with another drop shadow filter applied in the same manner? Instead, they just seem to merge into one, singular drop shadow. Weird...
BryanTheCrow said on Apr 12, 2006 at 8:24 AM :
Yes, I know they're only available in 8. I was trying to find a hack that would allow me to compile one .swf that would apply the new filters for Flash 8 users, but not lock out Flash 7 users. The solution I came to was to compile 2 versions and build a JavaScript object that would detect the Flash version a user has, and load the correct .swf, or display a link to download Flash based on the version detected. It works pretty well.

Here's my Flash-Version detection & version compare JavaScript methods for anyone who might want to implement something similar:

// Returns true if the version meets the passed-in minimum version.
function flashVersionMeets(sMinVersion) {
var $min = sMinVersion.split('.'), $ver = getFlashVersion().split('.');
while ($min.length < 4) $min.push(0); while ($ver.length < 4) $ver.push(0);
for (var x = 0; x < 4; x++) {
if (Number($ver[x]) > Number($min[x])) return true;
if (Number($ver[x]) < Number($min[x])) return false;
}
return true;
};

// Returns the version of flash that the user has installed, or 0 if none.
function getFlashVersion() {
if(navigator.plugins && navigator.mimeTypes.length) {
var oFlash = navigator.plugins['Shockwave Flash'];
if (oFlash && oFlash.description) {
return oFlash.description.replace(/([a-z]|[A-Z]|\s)+/, '').replace(/(\s+r|\s+b[0-9]+)/, '.');
}
} else if (window.ActiveXObject) {
try {
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').split(' ')[1].replace(/,/g, '.');
} catch (e) {}
}
return '0';
};

Just call flashVersionMeets("8") to see if the user has Flash 8 or higher, or flashVersionMeets("7") to see if they have 7 or higher. You can then generate your object / embed tags & add them wherever you want them to appear using regular old DOM scripting. You should already be scripting your object / embed tags in order to get around Microsoft's Patent Lawsuit loss (google it if you haven't heard about it yet)...

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002181.html