problems inserting movieclip

After successfully completing various tutorials I keep bumping onto a small problem that I can't seem to solve. I know I know, this probably is something small that I overlooked but I must have tunnelvision or something;)

I made a basic script to show what i mean. I made random sized blocks fall from random x positions onto a solid ground. Each time the timer releases a block ( a block = a movieclip called box) i see a rapid flash of the generated block in the top left corner and then it gets set to its random position. This flashing of blocks at the origin is very irritating and I want to get rid of it.

To make things more clear i have included the swf file. It would be great if someone could help me out.

Code:
   public function on_time(e:Event) {
               
               
                   body1Def = new b2BodyDef();
                   box1Def = new b2PolygonDef();
              var x = int;
              var y = int;
             
            
              body1Def.position.Set((Math.random()*30+2) / 2,0);//A little was added to make the boxes tilt left.
                 
                   box1Def.SetAsBox(x = Math.random()+01 , y = Math.random()+0.1);
                 
                   box1Def.density = 1.0;
                   box1Def.friction = 0.3;
                   body1Def.userData = new Box();
               
                  body1Def.userData.width = physScale * 2 * x  ;
                  body1Def.userData.height = physScale * 2 * y ;
                 
               
         body1 = m_world.CreateBody(body1Def);
                   body1.CreateShape(box1Def);
                   body1.SetMassFromShapes();
               addChild(body1Def.userData);
      }
Change code to this:
Code:
public function on_time(e:Event) {
               
               
                   body1Def = new b2BodyDef();
                   box1Def = new b2PolygonDef();
              var x = int;
              var y = int;
      //save x,y position
      var pos_x:Number =  (Math.random()*30+2) / 2;
      var pos_y:Number =  0;
           
              body1Def.position.Set(pos_x,pos_y);
                 
     
                   box1Def.SetAsBox(x = Math.random()+01 , y = Math.random()+0.1);
                 
                   box1Def.density = 1.0;
                   box1Def.friction = 0.3;
                   body1Def.userData = new Box();
               
                  body1Def.userData.width = physScale * 2 * x  ;
                  body1Def.userData.height = physScale * 2 * y ;

      //change x,y of the box before it appears on stage
      body1Def.userData.x = pos_x * physScale;
      body1Def.userData.y = pos_y * physScale;
                 
               
         body1 = m_world.CreateBody(body1Def);
                   body1.CreateShape(box1Def);
                   body1.SetMassFromShapes();
               addChild(body1Def.userData);
      }

and you'll be fine =)
Wow. Just wow! Thank you so very much for your help. I have to take a better look with the how and why you did the things that you have done, but it solved my problem. I didn't know how to set the coordinates before the movieclip was called to the screen. Thank you again!

Original thread: https://box2d.org/forum/viewtopic.php?t=2600