[問題] 主場景套用的Main.as內的函式如何被呼叫?

作者: nash777 (nash777)   2013-08-08 15:34:57
如標題
我在主場景上 套用了Main.as
然後在這個class內 寫了一個function
譬如
public function test(){
trace ('testing');
}
我在場景新增一個mc 套用一個mc.as
在此class內寫
public var aaa:Main = new Main();
在這個步驟執行就會報錯
如以下
Error: Error #2136: SWF 檔案 file:///C|/Users/Desktop/test/test.swf 包含
無效的資料。
at Mc()
at mc()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at Main()
這是錯在哪呢?
會這麼做的原因是想A.as呼叫B.as內的function和變數
我試過如果不是套用主場景的情形下就可以正常使用
是否我要把我的邏輯的函式移出 套用主場景的Main.as?
煩請前輩們指導
謝謝
作者: p52189 (鼠霸)   2013-08-10 02:41:00
我猜有可能Main這個字不能用 把類別名稱換掉試試我剛剛也試了一下 確實不行XD
作者: nash777 (nash777)   2013-08-15 11:36:00
後來看到套用場景的類別 不能被實體化 好像是因為這個原因

Links booklink

Contact Us: admin [ a t ] ucptt.com