I've copied and pasted your code and it seems to work. Sure, I don't know what your library symbol looks like (i just used a gray sqare) and I've replaced the houseXML
variable with static values. The code I've tried is the following:
var mcWhiteBorder:whiteBorder = new whiteBorder();
var dropShadow:DropShadowFilter = new DropShadowFilter();
dropShadow.distance = 1;
dropShadow.alpha = .2;
dropShadow.blurX = 10;
dropShadow.blurY = 10;
mcWhiteBorder.height = 200;
mcWhiteBorder.width = 300;
mcWhiteBorder.x = 50;
mcWhiteBorder.y = 50;
mcWhiteBorder.filters = [dropShadow];
addChild(mcWhiteBorder);
It seems to work just fine.. Check your houseXML
and see if the values you assign are valid and so on.
I've had some problems in the past with this, also. I've come to the conclusion that it always works if you're adding the filter to the existing filter array, instead of creating a new one, even if it's empty. I'm not really sure why. Your code would be something like:
var mcWhiteBorder:whiteBorder = new whiteBorder();
var tmpFilters:Array = mcWhiteBorder.filters;
var dropShadow:DropShadowFilter = new DropShadowFilter();
dropShadow.distance = 1;
dropShadow.alpha = .2;
dropShadow.blurX = 10;
dropShadow.blurY = 10;
mcWhiteBorder.height = houseXML.height-40;
mcWhiteBorder.width = houseXML.width+5;
mcWhiteBorder.x = houseXML.photoX-10;
mcWhiteBorder.y = houseXML.photoY+20;
tmpFilters.push(dropShadow);
mcWhiteBorder.filters = tmpFilters;
addChild(mcWhiteBorder);
So instead of asigning a filter to the filters
property, you're actually adding that filter to the existing ones. I'm curious if that works.