我的类中有一个返回数组的函数。问题是,使用时出现堆栈溢出错误。重要的功能是:
ScrollList/returnArmy
public function returnArmy ( army:int ):Array
{
var returnVar:Array;
if( army == 0 ) returnVar = army1_;
else if( army == 1 ) returnVar = army2_;
else if( army == 2 ) returnVar = army3_;
else if( army == 3 ) returnVar = army4_;
else if( army == 4 ) returnVar = army5_;
else if( army == 5 ) returnVar = army6_;
else if( army == 6 ) returnVar = army7_;
else if( army == 7 ) returnVar = army8_;
else returnVar = new Array;
return returnVar;
}
SkirmishScreen/returnArmy
public function returnArmy ( army_:int ):Array
{
var retArmy:Array = returnArmy( army_ );
return retArmy;
}
SkirmishScreen/returnArmy 在循环中被调用,使用
screensAR_[3] = new PlayScreen( stage, screensAR_[2].returnArmy( 0 ) );
使用 new Array() 初始化 Army1_ 到 8_。任何人都可以帮忙吗?
编辑:确切的错误是:
错误:错误 #1023:发生堆栈溢出。在 SkirmishScreen/returnArmy()