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.
精彩评论