Tricky rollover and rollout situation

I have attached a swf file here, showing how close I am to getting this rollover issue to work.

As you look at the file, I have one large image and 5 small buttons attached to it. What I need to happen is that the large image has a subtle rollover and roll out action. The roll over actino aoccurs when you roll over the image or any of the overlapping buttons and the roll out action does not occur until the mouse has completely left the image and button area.

The trick is that the buttons overlap the image, which has caused me some problems.

Here is the code I am using, but it is not working correctly and I can’t figure out why.

<code>

var animState:Number = new Number();//creates status variable
animState = 0;//this variable lets you know if a button has been rolled over or not.
_root.createEmptyMovieClip(“listener”, 3);
listener.onEnterFrame = function() {//this movieclip watches to see if your mouse has rolled out of the area with your buttons in it
if (_xmouse<768 && _ymouse<353 && _xmouse>300 && _ymouse>0) {//if it has,
CarMovie.gotoAndPlay(“out”);
animState = 0;//tells the movie to let the buttons respond again to being rolled over
}
};

btn1.onRollOver = function() {
if (animState == 0) {//if no buttons have been rolled over yet,
CarMovie.gotoAndPlay(“over”);//play the animation
animState = 1;//tell the movie that the animation is already playing.
}
};
btn2.onRollOver = function() {//same code as for button1
if (animState == 0) {
CarMovie.gotoAndPlay(“over”);
animState = 1;
}
};

btn3.onRollOver = function() {//same code as for button2
//trace(“onbtn3”);
if (animState == 0) {
CarMovie.gotoAndPlay(“over”);
animState = 1;
}
};
btn4.onRollOver = function() {//same code as for button1
if (animState == 0) {
CarMovie.gotoAndPlay(“over”);
animState = 1;
}
};

btn5.onRollOver = function() {//same code as for button1
if (animState == 0) {
CarMovie.gotoAndPlay(“over”);
animState = 1;
}
};

</code>

I am relatively new to actionscript, so any help would be greatly appreciated!

I’m not sure how you’re setting it up, but I’d use hitTest instead of manually determining X/Ymouse positions. Something like [AS]for(i=1;i<=5;i++) {
this[“btn”+i].onRollOver = function {
if(this.hitTest(_root._xmouse, _root._ymouse) || _root.bgImage.hitTest(_root._xmouse, _root._ymouse) {
CarMovie.gotoAndPlay(“over”);
}
}
}[/AS]

Thanks. Like I said, I am newer to actionscript and I don’t quite understand where this code you sent goes with what I have done. Can you comment this a little and help me understand it?