package dnd {
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import globalvars;
	
	
	public class handle extends MovieClip{
		
		protected var origPos:Point;
		
		public function handle() {
			// constructor code
			buttonMode = true;
			origPos = new Point(x,y);
			addEventListener (MouseEvent.MOUSE_DOWN, down);
		}

		protected function down (event:MouseEvent):void
		{
			play();
			globalvars.datt.countHandle = globalvars.datt.countHandle + 1;
			stage.addEventListener (MouseEvent.MOUSE_UP, stageUp);
				if (globalvars.datt.countHandle >= 3) {
					stage.addEventListener (MouseEvent.MOUSE_UP, stageUp1);					
					play();
					nCount=nCount+1;
					globalvars.datt.nCount = nCount; 
					if (nCount == 4)
					{
						globalvars.datt.Ppp = 1.5 + rand1;
					}
					
				}
		}
		
		protected function stageUp (event:MouseEvent):void
		{
			stage.removeEventListener (MouseEvent.MOUSE_UP, stageUp);
		}
		
		protected function stageUp1 (event:MouseEvent):void
		{
			stage.removeEventListener (MouseEvent.MOUSE_UP, stageUp1);

		}
	}
	
	
}

	function randomNumbers1(min1:Number,max1:Number):Number {
   		var Results1:Number=Math.floor(Math.random()*(max1 - min1 + 1) + min1);
   		return Results1;
	};

	var nCount:int = 0;
	var rand1:Number = randomNumbers1(0.1,0.5);