Collision Function Problem

Today at school a friendly friend named Rick wrote up a function thingy, and gave it to me. I’m trying to use it to make a collision cause an if statement, or something along those lines.

Anyway, if there’s anything wrong with his function, then maybe that’s the problem, but I’m guessing that it’s probably me, and if anyone could take a look at the .Fla, that would be great.

[AS]//function is copyright of richard young 2003
function objectcollision(name, name2) {
var oneX = name._x;
var oneY = name._y;
var oneDiffX = name._width/2;
var oneDiffY = name._height/2;
var twoX = name2._x;
var twoY = name2._y;
var twoDiffX = name2._width/2;
var twoDiffY = name2._height/2;
var distanceX = oneX-twoX;
var distanceY = oneY-twoY;
var area = (oneDiffX+oneDiffY)(twoDiffX+twoDiffY);
if (distanceX
distanceX+distanceY*distanceY<=area) {

	return true;
return false;


if (objectcollision(thing, other)) {