# Send movieClips randomly into the stage

**URL:** <https://forum.kirupa.com/t/send-movieclips-randomly-into-the-stage/290939>\
**Category:** Uncategorized\
**Created:** [June 22, 2009, 2:36pm UTC](https://forum.kirupa.com/t/send-movieclips-randomly-into-the-stage/290939 "2009-06-22T14:36:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![regbolD](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@regbolD](https://forum.kirupa.com/u/regbolD)\
**Post date:** [June 22, 2009, 2:36pm UTC](https://forum.kirupa.com/t/send-movieclips-randomly-into-the-stage/290939/1 "2009-06-22T14:36:53Z")

</div>

I am generating movieClips outside of the stage I want to send them randomly into the stage in enter frame.  
Currently it looks like this, so they go like in all directions…  
How could I direct each of them randomly \*\*into \*\*the stage?

```auto

function timerEvent(e:TimerEvent):void {

    var newObj:MyObj=new MyObj();

    //this places them randomly outside of the stage
    var side:String = RandomOffStage.position(newObj, null, stage, constantString);

    newObj.speedX=Math.random()*20-10;
    newObj.speedY=Math.random()*20-10;

    myArray.push(newObj);
}
addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
function enterFrameHandler(e:Event):void {

    for (var i:uint = 0; i < myArray.length; i++) {

        var myObj:MyObj = (MyObj)(myArray*);

        myObj.x+=myObj.speedX;
        myObj.y+=myObj.speedY;
    }
}

```
