1612 posts
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Contributed a free file of the month
+9 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 :)

4591 posts Community Mod Building awesome stuff for your mobile devices!
  • Contributed a blog post
  • Elite Author: Sold more than $75,000 on Envato Market
  • Helps us moderate the forums
  • Has sold $125,000+ on Envato Market
+15 more
Enabled 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
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
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
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
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)

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by