Strange behavior with small X increments

Hi, i’m currently working on the GUI for a tower defense and i’ve created a list of sliding “tablets” that represent the incoming waves (like gem td, desktop tower defense etc) and i’ve encountered some seemingly erratic behavior. I created a small example that successfully displays this odd behavior.

Copy and paste this code into a new flash document


var array:Array = new Array();
array = [];
grr();
addEventListener(Event.ENTER_FRAME, update);


function grr(){
for(var i:int = 0; i < 10; i++){
    var box:MovieClip = new MovieClip();
    box.graphics.beginFill(0x000099);
    box.graphics.drawRect(0,0,35,10);
    box.graphics.endFill();
    if(i > 0){
        box.x = (100 + (box.width * i)) + 2 * i;
        box.y = 200;
    } else {
        box.x = 100;
        box.y = 200;
    }
    stage.addChild(box)
    array.push(box);
}
}

function update(e:Event) {
    for(var i:int = 0; i<array.length;i++){
        array*.x -= 0.05 // this number causes strange behavior... as do some others
    }
}

The squares seem to move at different speeds at different times, depending on what number you use to increment the X value of the squares, and it only seems to be for very small decimals. I am at a loss as to why this would happen, if someone could please explain it to me, and possibly a way to fix it. thanks :smirk: