开发者

1180 and 1060 Migration, scrolling gallery, As3

I've got a scrolling gallery in AS2, I'm converting to AS3. I changed the noticable AS2 stuff. I don't know how to replace getProperty and setProperty. How do I migrate this code?

Thanks in advance,

/*
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 =开发者_JAVA技巧 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));
}
}


BUTTON[i].x

So, instead of setProperty(BUTTON[i], x, 200) it is just BUTTON[i].x = 200 and instead of getProperty(BUTTON[i], x) it is just BUTTON[i].x.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜