我開始使用Flash CS6首次嘗試做的Scaleform UI對UDK。我正在遵循這個簡單的教程:http://goo.gl/yedMU。我已經把它寫到了這封信上,但似乎無法讓它工作。我甚至在一個新的項目中再次嘗試過,但最後卻出現了同樣的錯誤。我三重檢查了每個名稱和實例,但它拒絕工作。下面是兩個框架的文件中的非常簡單的代碼:的Flash CS6錯誤#1009 - 巴頓消失
import flash.events.MouseEvent;
import flash.system.fscommand;
import flash.display.MovieClip;
subMenu_btn.addEventListener(MouseEvent.CLICK, subMenu);
exit_btn.addEventListener(MouseEvent.CLICK, exitGame);
var cursor:cursor_mc = new cursor_mc();
addChild(cursor);
cursor.x = mouseX;
cursor.y = mouseY;
cursor.startDrag();
stop();
function subMenu(event:MouseEvent):void
{
gotoAndStop('Sub Menu');
}
function exitGame(event:MouseEvent):void
{
fscommand('ExitGame');
}
和
play_btn.addEventListener(MouseEvent.CLICK, playGame);
back_btn.addEventListener(MouseEvent.CLICK, backBtn);
function playGame(event:MouseEvent):void
{
fscommand('PlayMap');
}
function backBtn(event:MouseEvent):void
{
gotoAndStop('Main Menu');
}
我使用的調試和
exit_btn.addEventListener(MouseEvent.CLICK, exitGame);
任何想法的代碼休息?整個事情的工作,直到我用'返回'按鈕返回到第一幀,當'退出'按鈕消失,我得到這個錯誤。然而,'子菜單'按鈕仍然可用,菜單仍可操作。
這是使用調試器中的錯誤:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Menu_fla::MainTimeline/frame1()[Menu_fla.MainTimeline::frame1:6]
at flash.display::MovieClip/gotoAndStop()
at Menu_fla::MainTimeline/backBtn()[Menu_fla.MainTimeline::frame2:10]
是否有「主菜單」框上的「exit_btn」?你正在告訴Flash聽一些不在那裏的東西。右側有一個邊欄,裏邊有很多與你有同樣問題的人,你可能想要查看。 – Duke 2012-08-08 01:46:34
我瀏覽過這些帖子中的每一個,但沒有找到答案。這裏是該項目,所以你可以看到它:http://www.sendspace.com/file/f8y82w – Taslem 2012-08-08 01:54:01
我相信正在發生的事情是Flash每次你改變一個幀都會將所有的影片剪輯「零」你可以看到這個,如果你調試並看看這個 - > exit_btn(它的值爲空)。我會在答案部分發表我的建議。 – Duke 2012-08-08 02:39:04