# Array acsess for dynamic \_mc messing up my Stage scale

**URL:** <https://forum.kirupa.com/t/array-acsess-for-dynamic--mc-messing-up-my-stage-scale/219547>\
**Category:** Uncategorized\
**Created:** [March 17, 2007, 7:32pm UTC](https://forum.kirupa.com/t/array-acsess-for-dynamic--mc-messing-up-my-stage-scale/219547 "2007-03-17T19:32:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshchernoff](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshchernoff/32/1852_2.png) [@joshchernoff](https://forum.kirupa.com/u/joshchernoff)\
**Post date:** [March 17, 2007, 7:32pm UTC](https://forum.kirupa.com/t/array-acsess-for-dynamic--mc-messing-up-my-stage-scale/219547/1 "2007-03-17T19:32:29Z")

</div>

:::Semi RESOLVED:::

I found a bug with use of \_X and \_Y. even though vars are case sensitive in the case of \_Y and \_X Auto format will change them in to lower case \_y and \_x and still even then, the use of upper case will still apply what ever value of that var to the \_y and \_x of the \_root

Now that I dont have the stage shifting any more I went back to look at my trace and to my surprise it’s still the same.

I assume that it’s because of the array style scope. when in debug the  
the level0 and level0.stage is the same width and height.  
befor the function and after

Ok I know it’s not the cleanest code. But because of what ever when using  
this["whatever’].\_x plays with width of stage

so when I play I trace on the stage via trace(Stage.width); and then do a  
this["whatever’].\_x = “whatever”, then I do a trace again on the stage  
and it changes because of this["whatever’].\_x

```auto
var _w:Number;
var _h:Number;
trace(Stage.width+" "+Stage.height)

//make main clip
this.createEmptyMovieClip("tileMaster", this.getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);

//load image in clip
mcLoader.loadClip("Untitled-1.png", tileMaster);
//exe after load image secess
function onLoadInit() {
    _w = tileMaster._width;
    _h = tileMaster._height;
    tile();
}

// get times will fit on stage width and height
function numRoundTo(n:Number, p:Number):Number {
    return Math.round(Math.pow(10, p)*n)/Math.pow(10, p);
}

function tile() {
    //get size of image
    var sH = stage._height;
    var sW = stage._width;
    var _mcH:Number = Math.ceil(sH/_h)+1;
    var _mcW:Number = Math.ceil(sW/_w)+1;
    // quanity of times will fit
    var q:Number = _mcW*_mcH;
    //vars for pattern top to bottom, left to right
    var Y:Number = 0;
    var X:Number = 0;
    //trace testing//
    trace(_h+" / "+stage._height+" = "+_mcH);
    trace(_w+" / "+stage._width+" = "+_mcW);
    //loop in pattern
    for (i=0; i<q; i++) {
        stage.createEmptyMovieClip("tileCopy"+i, stage.getNextHighestDepth());
        stage["tileCopy"+i].loadMovie("Untitled-1.png");
        if (Y<_mcH) {
            //trace(_y+"Y");
            stage["tileCopy"+i]._y = _h*Y;
            stage["tileCopy"+i]._x = _w*X;
            Y++;
        } else {
            //trace(_x+"X");
            stage["tileCopy"+i]._x = _w*X;
            Y = 0;
            X++;
        }
    }
    trace("Stage after function "+Stage.width+" "+Stage.height)
}

```
