1180和1060迁移,滚动图库,As3

时间:2010-07-19 20:26:36

标签: flash actionscript-3

我在AS2有一个滚动画廊,我正在转换 到AS3。我改变了那些值得注意的AS2东西。我不 知道如何替换getProperty和setProperty。如何迁移此代码?
提前谢谢,

/*
1180 and 1060 Migration Issue
getProperty and setProperty no longer used
*/
//SCROLLING GALLERY
addEventListener(Event.ENTER_FRAME, masterLoop);
function masterLoop(e:Event){
    var mouseMin:int = 0;
    var mouseMax:int = 0;
var BUTTON:Array = new Array();
BUTTON[0] = z1;
BUTTON[1] = z2;
BUTTON[2] = z3;
BUTTON[3] = z4;
BUTTON[4] = z5;
//...
for(var i:int=0; i<5; i++){
    var mouseX:int = 0;
if (mouseX > -360 && mouseX < 360)
{
mouseX = Math.ceil(mouseX);
}else{
mouseX = 20;
}
if (i<12){
    var menuX:int = 0;
    var menuX2:int = 0;
menuX = Math.ceil(getProperty (BUTTON[i], x));
menuX2 = Math.ceil(getProperty (BUTTON[i+1], x));
}else{
menuX2 = Math.ceil(getProperty (BUTTON[0], x));
}
if (i < 12 && menuX2 > menuX){
setProperty(BUTTON[i+1], x, menuX + 130);
}   
if (mouseX < mouseMin && menuX < 1060) {
diff = (mouseMin-mouseX)/20;
setProperty(BUTTON[i], x, menuX+diff);
}else if (mouseX <= mouseMin && menuX >= 1060) { 
diff = Math.ceil((mouseMin-mouseX)/15);
diff = diff + (menuX - 1060);
setProperty(BUTTON[i], x, (-500 + diff))
} 
if (mouseX > mouseMax && menuX > -500) {
diff = (mouseX-mouseMax)/20;
setProperty(BUTTON[i], x, menuX-diff); 
} else if (mouseX >= mouseMax && menuX <= -500) {
    var diff:int = 0;
diff = Math.ceil((mouseMin-mouseX)/15);
diff = diff + (menuX + 500);
setProperty(BUTTON[i], x, (1060 + diff));
}
}

1 个答案:

答案 0 :(得分:0)

BUTTON[i].x

所以,而不是setProperty(BUTTON [i],x,200)它只是BUTTON [i] .x = 200而不是getProperty(BUTTON [i],x)它只是BUTTON [i] .x