Roll over and roll out problem in class - keep triggering

Hi there,

I’m having troubles with the roll_over and roll_out mouse events. I’m working in flash CS5. I made a custom class (“Holder”, extends Sprite), which draws a rectangle on the stage when an object of the class is initiated. In the class are two eventlisteners, as said, roll_over and roll_out.

The problem: They keep triggering the event, also when the mouse is hold still. Hovering over the Holder object results in roll over > roll out > roll over > etc. How come? It should just trigger once, when over the object, and once, when rolling off, isn’t it?

Thanks!

The .fla file only contains:

var holder:Holder = new Holder(50, 50, 100, 100, 1/2);
stage.addChild(holder);

The Holder class:

package {
	import flash.display.Sprite;
	import flash.display.Shape;
	import flash.events.Event;
	import flash.events.MouseEvent;

	public class Holder extends Sprite {
		// variables
		var xPos:int;
		var yPos:int;
		var holderWidth:int;
		var holderHeight:int;
		var sliderFrac:Number;// fraction the slider is of the total height of the holder, NOT YET USED
		
		var rect:Sprite;	
		
		/* constructor */
		public function Holder(hX:int,hY:int,hWidth:int,hHeight:int, sF:Number) {
			// constructor code
			xPos = hX;
			yPos = hY;
			holderWidth = hWidth;
			holderHeight = hHeight;
			sliderFrac = sF;

			init();
		}
		
		private function init():void {
			rect = new Sprite();
			addChild(rect);
			
			drawRect();
			
			addEventListener(MouseEvent.ROLL_OVER, startSlide);
			addEventListener(MouseEvent.ROLL_OUT, stopSlide);
		}
		
		private function drawRect():void {
			rect.graphics.lineStyle(1,0x000000);// set line style and color, 1 pixel/black
			rect.graphics.beginFill(0xFFFF00);// set fill color, yellow
			rect.graphics.drawRect(xPos, yPos, holderWidth, holderHeight);// draw the rectangle
			rect.graphics.endFill();
		}
		
		private function startSlide(evt:Event):void{
			trace("Start slide");
		}
		
		private function stopSlide(evt:Event):void{
			trace("Stop slide");
		}

	}

}