【发布时间】:2014-08-05 14:38:30
【问题描述】:
当我在 Adobe Flash CC 中测试我的游戏时,我收到此错误:TypeError: Error #1009: Cannot access a property or method of a null object reference.
这基本上是围绕错误的代码(我删除了不重要的部分以使其更清晰):
package ui.levelSelect {
import flash.display.MovieClip;
public class LevelsContainer extends MovieClip {
public var levelThumbs:Array;
public var levels:Array = [{name:'level1'},{name:'level2'}];
public function LevelsContainer(){
for(var i:String in levels) {
var index:int = int(index);
levelThumbs[index] = new MovieClip; //This is the line where I get the error
}
}
}
}
是什么导致了这个错误? levelThumbs 已经声明对了吗?将其更改为this.levelThumbs 也不起作用...
【问题讨论】:
标签: actionscript-3 flash actionscript movieclip