easy Actionscript 3 help please

Soldato
Joined
11 Jan 2008
Posts
5,193
Location
Nowhere
So I'm trying to create a very basic vertical slider in Flash CS4, click on circle at the top of a line and drag it to the bottom, unclick and the animation continues.

Now i've got this working horizontally but vertically its not playing fair, below is the code I'm using (where "slider" is the circle in the example aforementioned).

Code:
stop();

stage.addEventListener(Event.ENTER_FRAME, checkPage);

var boundsRect:Rectangle=new Rectangle(467,267,0,125);


function sliderDragOn(event:MouseEvent):void {
	slider.startDrag(false, boundsRect);
	stage.addEventListener(MouseEvent.MOUSE_UP, sliderDragOff);
}


function sliderDragOff(event:MouseEvent):void {
	slider.stopDrag();
	stage.removeEventListener(MouseEvent.MOUSE_UP, sliderDragOff);
}


function checkPage(e:Event):void {
	if (slider.y<142) {
		gotoAndStop("end2");
	}
}

And I get the following "OUTPUT" error:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@269bf561 to flash.geom.Rectangle.

Any help appreciated!

EDIT: I can drag the circle up and down ok, but unclicking has no effect so its a slider with no purpose.
 
Last edited:
Back
Top Bottom