0

我第一次使用函数,我不明白为什么这段代码会带回来:

错误 #1007:在非构造函数上尝试实例化

在 myfla_fla::MainTimeline/showERM()

在 myfla_fla::MainTimeline/oponents()

在 myfla_fla::MainTimeline/frame4()

在 flash.display::MovieClip/gotoAndStop()

在 myfla_fla::MainTimeline/myKD3()

这是代码:

var ERMstand:Array = new Array ( met1stand,met2stand,met3stand );
var roundposition:Number = 1;
var ER:Array = new Array;
var EProc:Array = new Array;
var EAtt:Array = new Array;
var EDef:Array = new Array;
var EMob:Array = new Array;
var EHea:Array = new Array;
var EEne:Array = new Array;
var st1r1ER:Array =new Array ( "met1","met2","met3" );
var st1r1ERMMC:Array = new Array ( "0","1","2" )
var st1r1EProc:Array = new Array ( "5","20","8" );
var st1r1EAtt:Array = new Array ("3","10","15" );
var st1r1EDef:Array = new Array ("25","4","4" );
var st1r1EMob:Array = new Array ("3","8","10" );
var st1r1EHea:Array = new Array ("10","5","5");
var st1r1EEne:Array = new Array ("5","5","5");

oponents();

function oponents() {
if (stageposition == 1) {
    if (roundposition == 1) {
        ER = st1r1ER
        EProc = st1r1EProc
        EAtt = st1r1EAtt
        EDef = st1r1EDef
        EMob = st1r1EMob
        EHea = st1r1EHea
        EEne = st1r1EEne
        showERM(st1r1ERMMC.length, st1r1ERMMC)



    }
}
}




function showERM(popRM:Number, ERMS:Array) {
for (loop=0 ;loop<popRM;loop++){
    Robotmaster =new ERMS[loop]();
    Robotmaster.name = "ERM" + loop;
    addChild(Robotmaster);
    if (loop == 0) {
        Robotmaster.y = 415;
        Robotmaster.x = 425;
    } else if (loop == 1) {
        Robotmaster.y = 365;
        Robotmaster.x = 425;
    } else if (loop == 2) {
        Robotmaster.y = 315;
        Robotmaster.x = 425;
    } else if (loop == 3) {
        Robotmaster.y = 265;
        Robotmaster.x = 425;
    } else if (loop == 4) {
        Robotmaster.y = 215;
        Robotmaster.x = 425;
    }
}
}

提前致谢!

4

0 回答 0