Stage shifts when using addChild?

Posted by josh on Stack Overflow See other posts from Stack Overflow or by josh
Published on 2010-01-06T22:40:13Z Indexed on 2010/06/09 5:02 UTC
Read the original article Hit count: 228

I'm having a very odd bug with ActionScript 3 in Flash CS4. I am adding movie clips to a stage in a for loop and then moving them out of view so that I can pull them in and remove them when I need them.

I've narrowed down the issue to a point that I know that every time one of the movie clips are added to the stage using addChild(), the stage shifts to the right by one pixel. I know that sounds odd, but it's literally true... the 0 line on the y axis is shifted to the right one pixel every time the movie clip is added. I have no idea how this could be happening.

Here's the code that is doing the work:

        private function setupSlides():void 
    {
        for(x = 0; x < TOTAL_SLIDES; x++)
        {
            var ClassReference:Class = getDefinitionByName("Slide" + (x+1)) as Class;
            var s:MovieClip = new ClassReference() as MovieClip;
            s.x = 9999;
            s.y = 9999;             
            addChild(s);
            slides[x] = s;
        }
    }

Any thoughts?

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3