2011-12-19 90 views

回答

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

奇怪,不管我的對象鏈接到AS3或由它的名字稱呼它,我總是會得到'訪問未定義的屬性artGrunge1.'在庫中,也許我必須在本地調用它? – 2011-12-20 23:24:52

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) 
+1

'addChild'函數會自動將其添加到堆棧的頂部,因此除非您希望進一步縮小,否則不需要使用'addChildAt'。 – 2011-12-19 20:06:56

+0

謝謝,但我得到這個:'試圖訪問不可訪問的方法numChildren通過引用與靜態類型flash.display:Stage.' – 2011-12-20 23:31:42

+0

@atonparker - 真,我想我只用於循環添加多個對象 – tetris11 2011-12-22 11:12:55