Skip to main content
May 5, 2007
Answered

startDrag with AS3

  • May 5, 2007
  • 1 reply
  • 650 views
I'll get over it, but could use some help; here's what I am trying to do. I have an image of a bee, it's an instance on stage (ins_bee), I simply want to use it as a mouse pointer, but cannot seem to identify the bounds correctly:

import flash.events.MouseEvent;
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE,moveBee);
function moveBee(e:MouseEvent):void {
this.ins_bee.startDrag(true, ***need help here***);
}
This topic has been closed for replies.
Correct answer
you might want to take into accout the clips dimensions so maybe
var rect:Rectangle=new Rectangle(0,0,800-ins_bee.width,600-ins_bee.height)
assuming a top left reg point

1 reply

May 5, 2007
why not just use
ins_bee.x=mouseX
ins_bee.y=mouseY
inside your event handler?
May 5, 2007
thanks for the quick response, but the parameter I am looking for defines the bounds of the rectangle--in this case it's just the extents of the stage, which is 800 by 600, (something about flash.gemo:Rectangle); I don't know really, it's been a struggle. Any additional insite would be helpful.
Correct answer
May 5, 2007
you might want to take into accout the clips dimensions so maybe
var rect:Rectangle=new Rectangle(0,0,800-ins_bee.width,600-ins_bee.height)
assuming a top left reg point