all groups > flash actionscript > september 2007 >
You're in the

flash actionscript

group:

ActionScript 3 startDrag not working the same as AS2


ActionScript 3 startDrag not working the same as AS2 splotter
9/21/2007 2:38:19 PM
flash actionscript:
does anyone know the correct syntax for the startDrag() function. I want to
limit my object draggable area to like 100px x 100px. in ActionScript 2 all I
needed was this.startDrag(100,100,100,100); AS3 is puking after I enter this
value.

any sugggestions?
Re: ActionScript 3 startDrag not working the same as AS2 splotter
9/21/2007 2:44:03 PM
this is my code by the way the startDrag is located at the bottom

package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;




public class DragDrop extends MovieClip
{
public var __targetPiece;
public var _origX:Number;
public var _origY:Number;

public function DragDrop()
{
_origX = this.x
_origY = this.y;
this.addEventListener(MouseEvent.MOUSE_DOWN, dragMovie);
this.addEventListener(MouseEvent.MOUSE_UP, dropMovie);
this.buttonMode = true;
}


private function dragMovie(event:MouseEvent):void
{
this.startDrag();
}


private function dropMovie(event:MouseEvent):void
{
this.stopDrag();
}
}
}

Re: ActionScript 3 startDrag not working the same as AS2 kglad
9/21/2007 3:05:19 PM
as2 would puke, too.

Re: ActionScript 3 startDrag not working the same as AS2 splotter
9/21/2007 3:07:11 PM
so how would this look
this.startDrag(lockcenter,true,20,20,20,20):void
Re: ActionScript 3 startDrag not working the same as AS2 splotter
9/21/2007 3:09:02 PM
also do I need to call

flash.geom.Rectangle;
Re: ActionScript 3 startDrag not working the same as AS2 SymTsb
9/21/2007 3:10:41 PM
no. You need to create a Rectangle bounding box.....


import flash.geom.Rectangle;

var dragBnd:Rectangle = new Rectangle( 20, 20, 20, 20 );

Re: ActionScript 3 startDrag not working the same as AS2 splotter
9/21/2007 3:13:42 PM
Re: ActionScript 3 startDrag not working the same as AS2 SymTsb
9/21/2007 6:04:50 PM
AddThis Social Bookmark Button