# Restricting multiple texts to a specific area when the mouse is moved

**URL:** <https://forum.kirupa.com/t/restricting-multiple-texts-to-a-specific-area-when-the-mouse-is-moved/284043>\
**Category:** flash\
**Created:** [March 14, 2009, 3:34am UTC](https://forum.kirupa.com/t/restricting-multiple-texts-to-a-specific-area-when-the-mouse-is-moved/284043 "2009-03-14T03:34:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![small\_guy](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@small\_guy](https://forum.kirupa.com/u/small_guy)\
**Post date:** [March 14, 2009, 3:34am UTC](https://forum.kirupa.com/t/restricting-multiple-texts-to-a-specific-area-when-the-mouse-is-moved/284043/1 "2009-03-14T03:34:07Z")

</div>

var myObj:Object = new Object();  
Mouse.addListener(myObj);  
function nameMove() {  
for (var i:Number = 0; i\<5; i++) {  
var wordContact:MovieClip = attachMovie(“wordContact”, “wordContact”+i, i);  
wordContact.\_x = Math.random()\*Stage.width;  
wordContact.\_y = Math.random()\*Stage.height;  
}  
}  
myObj.onMouseMove = nameMove;

The idea is I have this one line of text that appears 5 times (at once) but the 5 instances keep changing positions whenever the mouse is moved. The code above works fine BUT I do not want this text to appear all over the stage (which is does using Stage.width and Stage.height in my Math.random code).

Instead I want to restrict this action of the text to the upper right hand area of the stage in a space that has a w=566 and a h=74.

How would I achieve this? Thank you.
