3d Collision Detection

I’m having a bit of trouble with psuedo 3d collisions using spheres. I’m using _xscale and _yscale to emulate the z-axis (no horizon point), and am having trouble determining the distance between the objects on the z-axis based upon their relative scales.

I’m not concerned at this moment with creating new vectors based upon hit angles, just getting the z-index collision detection working.

(I also need to tweak the code to prevent trapping, so much todo)

Here’s the code, the issue is how do I determine the correct value for the z-axis in the hittest?
note-this only works when I publish in flash6 when using mx2004, the collision detection doesn’t work at all when published for flash7?!?

MovieClip.prototype.moveRandom=function(){
// create a random vector
this.vx=0;
this.vy=0;
this.va=0;
while(this.vx==0){this.vx=Math.round((Math.random()*1-1)*(Math.random()*10));}
while(this.vy==0){this.vy=Math.round((Math.random()*1-1)*(Math.random()*10));}
while(this.va==0){this.va=Math.round((Math.random()*1-1)*(Math.random()*10));}
this.onEnterFrame=function(){
// move the spheres along their vector
this._x+=this.vx;
this._y+=this.vy;
this._xscale+=this.va;
this._yscale+=this.va;
this.swapDepths(this._yscale*1000+this.id*10);
if(this._x>Stage.width || this._x<0){
this.vx*=-1;
}
if(this._y>Stage.height || this._y<0){
this.vy*=-1;
}
if(this._xscale>=100 || this._xscale<=0){
this.va*=-1;
}
// 3d collision detection
thisone=this;
for(p=1;p<_root.particlecount;p++){
if(_root[p]!=thisone){

// THIS IS THE LINE WITH THE PROBLEM
  if(thisone.hittest(_root[p]) && Math.abs(thisone._xscale-_root[p]._xscale)<5){
    _root[p].vx*=-1;
    _root[p].vy*=-1;
    _root[p].va*=-1;
  }
}
}
updateAfterEvent();
};// end enterframe
};// end move random prototype

// create the spheres
particlecount=15;
for(p=1;p<=particlecount;p++){
_root.createEmptyMovieClip(p,p);
with(_root[p]){
id=p;
a=b=20;
colors =[ 0xffffff,Math.round(Math.random()*0xffffff) ];
alphas =[ 100,100 ];
ratios =[ 0,255 ];
matrix ={matrixType:'box',x:-a/1.5,y:-b*1.5,w:a*2,h:b*2,r:(90/180)*Math.PI };
lineStyle(1,0x0000ff,0);
beginGradientFill('radial',colors,alphas,ratios,matrix );
j=a*0.70711;n=b*0.70711;
i=j-(b-n)*a/b;m=n-(a-j)*b/a;
moveTo(a,0);
curveTo(a,-m,j,-n);
curveTo(i,-b,0,-b);
curveTo(-i,-b,-j,-n);
curveTo(-a,-m,-a,0);
curveTo(-a,m,-j,n);
curveTo(-i,b,0,b);
curveTo(i,b,j,n);
curveTo(a,m,a,0);
endFill();
_x=Math.ceil(Math.random()*(500-_xscale)+_xscale/2);
_y=Math.ceil(Math.random()*(250-_yscale)+_yscale/2);
_xscale=_yscale=Math.ceil(Math.random()*100);
}
_root[p].moveRandom();
}

Thanks for any help offered!