View Full Version : Prevent drop shadow from propagating to children?
evoluent
11-12-2008, 05:12 PM
Hi all,
How can I prevent a Drop Shadow from propagating to the children of an HBox?
Thanks for your help!
-Tony
Peter Cowling
11-12-2008, 08:26 PM
Hello,
Is the problem that your text is being affected?
If so, or regardless, try wrapping the HBox in a canvas and assigning your filter to that.
evoluent
11-12-2008, 08:37 PM
Is the problem that your text is being affected?
If so, or regardless, try wrapping the HBox in a canvas and assigning your filter to that.
Hi Peter,
Yes, both a Text component and a SWFLoader component are inheriting the Drop Shadow Filter from the HBox. Is this normal behavior?
I will try the canvas approach and check back in.
Thanks for your response!
evoluent
11-12-2008, 09:08 PM
In MXML, the DropShadow does not propagate to children
But in the following ActionScript for the exact same Flex components, the DropShadow does propagate to children:
Does anyone has any ideas?
var myHBox:HBox = new HBox();
myTileComponent.addChild(myHBox);
var my_shadow:DropShadowFilter = new DropShadowFilter();
var filtersArray:Array = new Array(my_shadow);
myHBox.filters = filtersArray;
var myText:Text = new Text();
myText.text = "Test";
myText.filters = null;
mYHBox.addChild(songTitle);
Peter Cowling
11-12-2008, 09:52 PM
Hi,
From Adobe:
Filters and Bitmap objects
When you apply any filter to a BitmapData object, the cacheAsBitmap property is automatically set to true. In this way, the filter is actually applied to the copy of the object rather than to the original.
This copy is then placed on the main display (over the original object) as close as possible to the nearest pixel. If the bounds of the original bitmap change, the filtered copy bitmap is recreated from the original, rather than being stretched or distorted.
If you clear all filters for a display object, the cacheAsBitmap property is reset to what it was before the filter was applied.
So you need to either wrap your HBox in a canvas and/or sit it on top of a canvas, and apply the filter to the canvas rather than the HBox. That is the case whether you are working with actionscript or mxml as far as I understand it.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.