1612 posts
  • Author had a Free File of the Month
  • Envato Studio (Microlancer) Beta Tester
  • Beta Tester
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Repeatedly helped protect Envato Market against copyright violations
  • Referred between 1 and 9 users
+5 more
DaniMun says

^ Ovidiu is right, always use the MOUSE _DOWN, MOUSE _MOVE, and MOUSE _UP events. Lee Brimelow does an amazing job explaining here and here a very good implementation of the above-mentioned events.

Give the tuts a look :)

4188 posts Community Mod Building awesome stuff for your mobile devices!
  • Community Moderator
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Repeatedly helped protect Envato Market against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
+9 more
Enabled Volunteer moderator says

It’s not a Flash bug, it’s a bug in your code. :-)

You need to detect when the mouse moves outside of the swf, and consider it a release, and do the proper action. You know that 90% of developers don’t take this into consideration? You can see this bug on a lot of Google Flash components as well. :D

Send me an email so I can give you a link to a free file done properly, and you can take the code from there. What we’ve done at Vuzum is create handlers for all states, and we add an event handler to any movieclip we want to have actions on, like this: mcName.addEvents(pathToWhereTheFunctionsAreDefinedUsuallyThis);

And then write the functions definitions, like: http://pastie.org/1708931

Ignore the switches and only see the functions and their parameters. It’s a copy/paste from whatever project I have opened right now.

And the prototype function looks like this: http://pastie.org/1708935

Basically those are the events you need to check for all possible states. I think this is the most up to date file, if not shoot me an email and I’ll send the link I mentioned initially. Good luck! :)

+100000 lol

2309 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 10 and 49 users
  • Repeatedly helped protect Envato Market against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
theflyingtinman says

the point is.. never use start/stop drag functions. they are crappy. use the combination mouseDown/mouseMove/mouseUp instead.

...with event.updateAfterEvent set on the mousemove event, in the the event handler, for much smoother moving.

2309 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 10 and 49 users
  • Repeatedly helped protect Envato Market against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
theflyingtinman says

The “bug” is not in the stopDrag() .. in fact stopDrag() is never even called when you release outside the stage because the mouse up event does not fire. (you can see the ball is still dragging when you bring the mouse back on stage without clicking another mouse down )

The solution is you need to define the startDrag with a bounding rectangle : eg.

ball.startDrag(true, new Rectangle(0,0,stage.stageWidth, stage.stageHeight));  

and then call stopDrag when you detect the mouse coming back on the stage

That will have the desired effect

(if you really must use startDrag / stopDrag)

by
by
by
by
by
by