开发者

A conflict exists with definition newBox in namespace internal

开发者 https://www.devze.com 2023-03-13 19:47 出处:网络
function makeABox(e):void { if (e.name == \"seri1\"){ var newBox:karo1 = new karo1(); }else if(e.name == \"seri2\"){

function makeABox(e):void {

if (e.name == "seri1"){

var newBox:karo1 = new karo1();

}else if(e.name == "seri2"){

var newBox:karo2 = new karo2();

}else{

var newBox:zemin1 = new zemin1();

}

ust_bar.addChild(newBox);

newBox.x = 开发者_如何学JAVAi*60;

newBox.y = s*60;

}


Dee, you should make a question. I'm presuming you got problems with 'namespaces'. Try to define de variable first, with a superclass type, then in those conditionals just give a value. Like this:

    function makeABox(e):void {
        var newBox:somesuperclass;
        if (e.name == "seri1") {
            newBox = new karo1();
        } else if (e.name == "seri2") {
            newBox = new karo2();
        } else {
            newBox = new zemin1();
        }
        ust_bar.addChild(newBox);
        newBox.x = i*60;
        newBox.y = s*60;
    }

This is actionsscript3? If is, you probably need e.currentTarget.name. Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消