Making attached mcs appear in certain places

How can I make a mc only appear on the edges of the screen? like shun
perfect example of what I wanna make (at the moment) How can I do something like that? This is the code I use for attaching movieclips:

bulletNum = 0;
function newEnemy2() {
    attachMovie("bullet","bullet"+bulletNum,getNextHighestDepth() );
      var bullet = eval("bullet"+bulletNum); 
    bullet._x = Math.random()*(500-50)+50;
    bullet._y = Math.random()*(350-50)+50;
 bullet.onEnterFrame = function() {
        bullet.x = bullet._x;
        bullet.y = bullet._y;
newEnemy2Int = setInterval(newEnemy2, 750+random(500));

(uses bullets as mc)

Thanks ^^ ill check this a lot