我使用的是Flash CS 5.5.if在錯誤發生時,我在按鈕單擊事件中調用了一個函數。任何人都說錯了什麼?TypeError:錯誤#1009:無法訪問空對象引用的屬性或方法
這是我的代碼:
var visited:Object = {
Movieclip: 0,
one: 0,
two: 0,
three: 0,
four: 0,
five: 0,
six: 0,
seven7: 0
};
function saveCourseStatus():void
{
var suspend_str:String = visited.Movieclip + "," + visited.one + "," + visited.two + "," + visited.three + "," + visited.four + "," + visited.five + "," + visited.six + "," + visited.seven;
scorm.set("cmi.suspend_data", suspend_str);
scorm.save();
}
Newbutton.addEventListener(MouseEvent.CLICK, Nxt);
function Nxt(event:MouseEvent):void
{
saveCourseStatus();
MovieClip(this.root).gotoAndPlay(0, "one");
}
我有這個error.saveCourseStatus();
peError: Error #1009: Cannot access a property or method of a null object reference.
at New_fla::MainTimeline/saveCourseStatus()[New_fla.MainTimeline::frame98:116]
at New_fla::MainTimeline/Nxt()[New_fla.MainTimeline::frame98:125]
什麼是'visited.MovieClip'?另外,檢查'visited'或'scorm'是否爲空。 – Vesper 2014-09-01 13:54:31
什麼是scrom?你在某個地方創造了它嗎? – mGolzadh 2014-09-02 06:38:50