PDA

View Full Version : Event.observe returns error


Sleeping_Troll
05-29-2009, 03:25 PM
Here is my script:
function init(){
for(i=0;i<numOrbs;i++){
Orb[i]=[];
Orb[i].Img=new Element("img",{id:i, src:"./images/Orb.png", style:"display=none", onMouseover:"GrabOrb(this.id,1)", onMouseout:"GrabOrb(this.id,0)"});
$("container").insert(Orb[i].Img);
Orb[i].Img.static=0
resize();
var theta;
Orb[i].PositionX=Xmax/2;
Orb[i].PositionY=Ymax/2;
Orb[i].PositionZ=Zmax*.0001;
theta=Math.PI*2*Math.random();
phi=Math.asin(Math.random());
if(Math.random()>0.5)phi=-phi;
Orb[i].VelocityX=InitialVelocity*Math.sin(theta)*Math.cos(phi);
theta=Math.PI*2*Math.random();
phi=Math.asin(Math.random());
if(Math.random()>0.5)phi=-phi;
Orb[i].VelocityY=InitialVelocity*Math.cos(theta)*Math.cos(phi);
theta=Math.PI*2*Math.random();
phi=Math.asin(Math.random());
if(Math.random()>0.5)phi=-phi;
Orb[i].VelocityZ=InitialVelocity*Math.cos(phi);
Orb[i].renew=0;
Event.observe(Orb[i].Img,"mouseover", GrabOrb(i,1));
Event.observe(Orb[i].Img,"mouseout", GrabOrb(i,0));
}
setInterval("collisions()",100);
}

function GrabOrb(ID,value){
Orb[ID].static=value;
alert(value);
}

it returns this error:

Message: 'handler' is null or not an object
Line: 4503 (prototype script)
Char: 11
Code: 0
URI: http://127.0.0.1/huduzu/Resources/prototype.js

I have posted the script on my host, and you can see it for yourself at:
http://huduzu.trollnest.com/index.php

Please help! I have been about 16 hrs on this and it is the last step for my "Orbs" widget and then I can get on to page content!