Friday, November 10, 2006

Excellent StartDrag tip

Ever wonder why when you use the startDrag and stopDrag action on a movie clip that sometimes the movie clip gets stuck to the mouse? It's because the mouse can move quicker than the movie clip, which is attached to a frame-based time and not real time. A quick tip that I just learned from Keith Peters' ActionScript Animation (Friends of Ed) is to add a stopDrag action to the onReleaseOutside method. So your action might look something like this:

clip.onPress = function() {
clip.startDrag();
}
clip.onRelease = function() {
clip.stopDrag();
}
clip.onReleaseOutside = function() {
clip.stopDrag();
}

Very cool stuff.

0 Comments:

Post a Comment

<< Home