# \[FMX2004\] Why does this script not work when published as Flash Player v7?

**URL:** <https://forum.kirupa.com/t/fmx2004-why-does-this-script-not-work-when-published-as-flash-player-v7/83340>\
**Category:** Uncategorized\
**Created:** [March 17, 2005, 10:52pm UTC](https://forum.kirupa.com/t/fmx2004-why-does-this-script-not-work-when-published-as-flash-player-v7/83340 "2005-03-17T22:52:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![beekay1076](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@beekay1076](https://forum.kirupa.com/u/beekay1076)\
**Post date:** [March 17, 2005, 10:52pm UTC](https://forum.kirupa.com/t/fmx2004-why-does-this-script-not-work-when-published-as-flash-player-v7/83340/1 "2005-03-17T22:52:17Z")

</div>

Hi there,

I was hoping someone could help me. I was given this piece of script by a friend. It’s placed on a movie clip instance and makes it bounce away from the mouse pointer in random directions and distances. It’s a great piece and works fine when you publish your flash movie as v6. But I’m wanting to use it in a movie that I have to publish as v7 with as2, and it doesn’t work at all when you do that. Anyone know why?

Here’s the code:

```auto
 
onClipEvent(load){
var x=_x;
var y=_y;
var n=function(){
c=10000;
b=Math.floor(Math.random()*100);
d=b*b;
a=Math.sqrt(c-d);
if(Math.random()*2>=1){
b=-b;
}
if(Math.random()*2>=1){
a=-a;
}
tx=x+b;
ty=y+a;
}
}
onClipEvent (enterFrame) {
xm=_parent._xmouse;
ym=_parent._ymouse;
if (this.hitTest(xm,ym,true)) {
if (done!=1) {
n();
done=1;
i=30;
}
}
i--;
if (i<=1) {
xdif=x-_x;
xspeed+=xdif/4;
xspeed*=.8;
_x+=xspeed;
ydif=y-_y;
yspeed+=ydif/4;
yspeed*=.8;
_y+=yspeed;
} else {
done=0;
xdif=tx-_x;
xspeed+=xdif/4;
xspeed*=.8;
_x+=xspeed;
ydif=ty-_y;
yspeed+=ydif/4;
yspeed*=.8;
_y+=yspeed;
}
}
 

```

Hoping someone knows,

BeeKay
