# Vibration Effect Question

**URL:** <https://forum.kirupa.com/t/vibration-effect-question/33953>\
**Category:** flash\
**Created:** [October 25, 2003, 10:53pm UTC](https://forum.kirupa.com/t/vibration-effect-question/33953 "2003-10-25T22:53:40Z")\
**Posts on this page:** 4\
**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/33953/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);  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 26, 2003, 10:15am UTC](https://forum.kirupa.com/t/vibration-effect-question/33953/2 "2003-10-26T10:15:38Z")

</div>

you mean something like this?  
[AS]onClipEvent (load) {  
this.\_x = 71.5;  
this.\_y = -.5;  
cx = this.\_x;  
cy = this.\_y;  
}  
onClipEvent (enterFrame) {  
this.\_x = cx+(Math.random()\*10);  
this.\_y = cy+(Math.random()\*10);  
}[/AS]

scotty (-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 26, 2003, 3:30pm UTC](https://forum.kirupa.com/t/vibration-effect-question/33953/3 "2003-10-26T15:30:40Z")

</div>

Thats great! thank you very much (p.s. I am a TOTAL newb @ this.)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 26, 2003, 3:37pm UTC](https://forum.kirupa.com/t/vibration-effect-question/33953/4 "2003-10-26T15:37:43Z")

</div>

no problem  
btw welcome to the forums:thumb:
