# Vibration Effect Question

**URL:** https://forum.kirupa.com/t/vibration-effect-question/93108
**Category:** Uncategorized
**Created:** [October 25, 2003, 10:53pm UTC](https://forum.kirupa.com/t/vibration-effect-question/93108 "2003-10-25T22:53:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Scorp\_BRH](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@Scorp\_BRH](https://forum.kirupa.com/u/Scorp_BRH)
#### Post date: [October 25, 2003, 10:53pm UTC](https://forum.kirupa.com/t/vibration-effect-question/93108/1 "2003-10-25T22:53:40Z")

</div>

Instead of having the image appear and start vibrating in a random position, how do you have it set up so it remains within a 10 pixel area of where placed on the FLA file, and vibrates there alone?

The image starts is at: (x:71.5,y:-0.5)  
and the sizes, which i also want to remain the same, are: (W:91.0,H:111.1)

The code I used is the same from the tutorial… which is:

onClipEvent (load) {  
//movie width/height  
height = 200;  
width = 300;  
//------------------------//  
//makes everything random //  
//------------------------//  
this.\_x = Math.round(Math.random()\*width);  
this.\_y = Math.round(Math.random()\*height);  
var temp = this.\_alpha=Math.random()\*100;  
this.\_xscale = this.\_yscale=temp;  
//setting initiaion position  
cx = this.\_x;  
cy = this.\_y;  
}  
onClipEvent (enterFrame) {  
//causes the object to be offset  
this.\_x = cx+(1+Math.random()\*5);  
this.\_y = cy+(1+Math.random()\*5);  
}
