【发布时间】:2012-07-08 09:22:02
【问题描述】:
我不是在谈论元/绑定,例如:
[SWF(backgroundColor="0xec9900")]
我需要能够即时更改颜色。
【问题讨论】:
标签: actionscript-3 flex4 flash-builder
我不是在谈论元/绑定,例如:
[SWF(backgroundColor="0xec9900")]
我需要能够即时更改颜色。
【问题讨论】:
标签: actionscript-3 flex4 flash-builder
在 Sprite 中绘制一个矩形并将其作为最低级别的子级添加到舞台。
var bg:Sprite;
function changeStageColor( color : uint ) : void {
bg ||= new Sprite();
bg.graphics.clear();
bg.graphics.beginFill( color, 1 );
bg.graphics.drawRect( 0,0, stage.stageWidth, stage.stageHeight );
bg.graphics.endFill();
stage.addChildAt( bg, 0 );
}
用法:
changeStageColor( 0xFF0000 );
【讨论】:
if (bg == null) bg = new Sprite();
我在我的主要精灵中使用它:
this.opaqueBackground = 0xff0000;
【讨论】:
在初始化时我放了:
this.backgroundSkin = new Quad(this.stage.stageWidth, this.stage.stageHeight, 0x007800);
【讨论】: