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<<16 | cg<<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.5Stage.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<=0.1*fieldlength) outofbounds = true;
if (_x<0-starsize || _x>Stage.width+starsize) outofbounds = true;
if (_y<0-starsize || _y>Stage.height+starsize ) outofbounds = true;
if ( outofbounds ) init(); // replace this star with a new one at maximum range
render();
}
}