Gabriel Meono
Gabriel Meono

Reputation: 1010

AS3: Add layer overlay on top of everything?

I want to add some extra texturing for my current game, let's say an overlayed grunge texture on top of everything.

My entire project (except background image) is set on a Main Class.

Is it Possible? How?

Screenshot:

enter image description here

Upvotes: 0

Views: 2303

Answers (2)

tetris11
tetris11

Reputation: 817

Cant entirely remember the correct syntax but couldn't you just do:

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)

Upvotes: 0

user1080806
user1080806

Reputation:

Sure, just disable any mouse input on the overlay and it will be like its not even there.

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);
}

Upvotes: 5

Related Questions