我尝试在 creationComplete 事件中为某些按钮添加阴影效果。
导入 flash.filters.DropShadowFilter;
// #1 Does work but removes other filters
protected function onButtonCreate(e:Event):void
{
(e.target as Button).filters = [new DropShadowFilter(1,45,0x000000,0.4,4,4,2,1,false,true,false)];
}
// #2 Does not work
protected function onButtonCreate(e:Event):void
{
(e.target as Button).filters.push(new DropShadowFilter(1,45,0x000000,0.4,4,4,2,1,false,true,false));
}
// #3 Does not work
protected function onButtonCreate(e:Event):void
{
(e.target as Button).filters[(e.target as Button).filters.length] = new DropShadowFilter(1,45,0x000000,0.4,4,4,2,1,false,true,false);
}
我究竟做错了什么?正确的方法是什么?
编辑:我正在使用 flex Spark 主题。按钮的过滤器数组没有元素但更改过滤器属性会删除所有应用的 Spark 主题样式?