# \[Flash8\] Mouse Traking

**URL:** https://forum.kirupa.com/t/flash8-mouse-traking/293051
**Category:** flash
**Created:** [July 22, 2009, 2:43pm UTC](https://forum.kirupa.com/t/flash8-mouse-traking/293051 "2009-07-22T14:43:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rsthilaire](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rsthilaire](https://forum.kirupa.com/u/rsthilaire)
#### Post date: [July 22, 2009, 2:43pm UTC](https://forum.kirupa.com/t/flash8-mouse-traking/293051/1 "2009-07-22T14:43:54Z")

</div>

I recently downloaded a star background for an ad. The site where the ad is posting does not allow mouse tracking. I have made an attempt at removing it from this script, and i know once i remove it it will work like a charm, unfortunately, when i remove mouse tracking, the whole code goes to hell because other chunks depend on it. Can someone take a look at it and let me know how to remove mouse tracking? I have highlighted the section i removed. Thank you!

class star extends MovieClip {  
private var px;  
private var py;  
private var pz;  
private var fieldsize;  
private var fieldlength;  
private var starsize;  
private var color;

```
function star() {
    fieldsize = Math.max(Stage.width,Stage.height);
    fieldlength = 1000;
    color = new Color(this);
    
init();        
pz = fieldlength*Math.random(); // initially distribute stars evenly throughout the field
render();
}

function init() {
  // give it a random size 
    starsize = 20 + 100*Math.random();
    
    // give it a bit of color
    var cr:Number = Math.floor(200 + 55*Math.random());
    var cg:Number = Math.floor(180 + 75*Math.random());
    var cb:Number = Math.floor(160 + 95*Math.random());
    color.setRGB(cr&lt;&lt;16 | cg&lt;&lt;8 | cb);

    // pick a start position
    px = 1.5*fieldsize*Math.random()-0.75*fieldsize;
    py = 1.5*fieldsize*Math.random()-0.75*fieldsize;
pz = fieldlength-_root.velocity*Math.random(); // start close to the far end of the field
}

function render() {
    _width = (fieldlength-pz)*starsize/fieldlength;
    _height = (fieldlength-pz)*starsize/fieldlength;
    _x = 0.5*Stage.width + px*fieldlength/pz;
    _y = 0.5*Stage.height + py*fieldlength/pz;
}

public function onEnterFrame() {
  pz -= _root.velocity; 

```

[COLOR=Red] if ( \_root.steering ) {  
var ax = 0.0015\*\_root.velocity\*(\_root.\_xmouse-0.5_Stage.width) /fieldsize;  
var ay = 0.0015_\_root.velocity\*(\_root.\_ymouse-0.5\*Stage.height)/fieldsize;  
var a,r;[/COLOR]

```
  // apply yaw      
    r = Math.sqrt(px*px + pz*pz);
    a = Math.atan2(pz,px) + ax;
    px = Math.cos(a)*r;
    pz = Math.sin(a)*r; 

  // apply pitch
    r = Math.sqrt(py*py + pz*pz);
    a = Math.atan2(pz,py) + ay;
    py = Math.cos(a)*r;
    pz = Math.sin(a)*r; 
  }
   
  var outofbounds = false;
  if (pz&lt;=0.1*fieldlength) outofbounds = true;
  if (_x&lt;0-starsize || _x&gt;Stage.width+starsize) outofbounds = true;
  if (_y&lt;0-starsize || _y&gt;Stage.height+starsize ) outofbounds = true;
  if ( outofbounds ) init(); // replace this star with a new one at maximum range

  render();
}

```

}
