Optimizing an Actionscript function
How can I optimize this function? (It's a function to set MovieClips to the next free position in a grid.)
var placecount:Number = 1
//
function setupPostButtons(e:Event=null):void
{
if(a1.length>5){
settingscont1.x = this["p"+[开发者_C百科placecount]].x
settingscont1.y = this["p"+[placecount]].y
placecount++
}
//
if(a2.length>5){
settingscont2.x = this["p"+[placecount]].x
settingscont2.y = this["p"+[placecount]].y
placecount++
}
//
if(a3.length>5){
settingscont3.x = this["p"+[placecount]].x
settingscont3.y = this["p"+[placecount]].y
placecount++
}
//
}
//
setupPostButtons()
精彩评论