AS3:在所有内容上添加图层叠加层?

时间:2011-12-19 19:30:10

标签: actionscript-3 overlay

我想为我当前的游戏添加一些额外的纹理,让我们在所有内容之上说一个叠加的纹理。

我的整个项目(背景图片除外)都设置在主类上。

可能吗?怎么样?

截图:

enter image description here

2 个答案:

答案 0 :(得分:5)

当然,只需禁用叠加层上的任何鼠标输入,它就像它甚至不存在一样。

public function LuckyHitBeta()
{
    ...

    var overlay:Sprite = new Sprite();
    overlay.addChild( /* your texture goes here  as a Bitmap */ );
    overlay.mouseEnabled = false;
    overlay.mouseChildren = false;
    addChild(overlay);
}

答案 1 :(得分:0)

完全不记得正确的语法,但你不能这样做:

import flash.display.Stage;
public class GlobalStage extends MovieClip

public static var theStage:Stage;
public static var theRoot:MovieClip;

public function GlobalStage() {
    theStage = this.stage;
    theRoot = this.root;
}
var grunge:MovieClip = new Grunge();
var topDepth:uint = theStage.numChildren()-1;
theStage.addChildAt(grunge, topDepth)
相关问题