Shapeflag HitTest for Deflection

** Please ignore, resolved (for now!) **

Hey guys, running a sunday afternoon project. Got into some trouble.

I have a cannon that fires into a wall. When the cannon ball hits the wall, it needs to deflect. The twist is that the wall is rotatable. You set the angle of the wall, and the ball needs to deflect appropriately.

When the wall is rotated, a bounding box hitTest is no good. I have used some maths so that I can work out the X&Y coords for the wall face, but I cant get them to work in a hitTest shapeflag. Can anyone point me in the right direction. I know the code is messy, sorry!

Here is the swf (you need to rotate both the red and yellow boxes): http://img135.imageshack.us/my.php?image=cannonww1.swf

and the code:


gravity = 1;
cx = cannon._x;
cy = cannon._y;
wx = wall._x;
wy = wall._y;

speed = 15;
depth = 0;
nose = cannon._width;


_root.cannon.onPress = function() {
    this.onEnterFrame = function(){
        var mx = _xmouse;
        var my = _ymouse;
        angle = Math.atan2(my-cy, mx-cx);
        _root.cannon._rotation = angle*180/Math.PI;
    }
}

_root.cannon.onRelease = function() {
    delete _root.cannon.onEnterFrame;
};


_root.wall.onPress = function() {
    this.onEnterFrame = function(){
        var mx2 = _xmouse;
        var my2 = _ymouse;
        _root.angle2 = Math.atan2(my2-wy, mx2-wx);
        _root.wall._rotation = angle2*180/Math.PI;
    }
}


_root.wall.onRelease = function() {
    delete _root.wall.onEnterFrame;

    _root.xcoordinate = _root.wall._x + (75*(Math.cos(_root.angle2)));
    _root.ycoordinate = _root.wall._y + (75*(Math.sin(_root.angle2)));
};


setInterval(fire, 2000);

function fire() {
    var cosAngle = Math.cos(angle);
    var sinAngle = Math.sin(angle);
    var noseX = nose*cosAngle;
    var noseY = nose*sinAngle;
    var x = cx+noseX;
    var y = cy+noseY;
    var newDepth = ++depth;
    var name = "ball"+newDepth;
    var clip = _root.attachMovie("ball", name, newDepth);
    clip._x = x;
    clip._y = y;
    clip.xmov = speed*cosAngle;
    clip.ymov = speed*sinAngle;
    clip.onEnterFrame = function() {
        this.ymov += _root.gravity;
        this._x += this.xmov;
        this._y += this.ymov;
        
        if(this.hitTest(_root.xcoordinate, _root.ycoordinate, true)) {
            trace("hit");
        }
    };
};