Results 1 to 2 of 2

Thread: startDrag / stopDrag Question...

  1. #1
    Join Date
    Apr 2006
    Thanked 0 Times in 0 Posts

    Default startDrag / stopDrag Question...

    Hi all...

    I have the following:

    main_left.dragbar_mc.onPress = function () 
    main_left.dragbar_mc.onRelease = dragbar_mc.onReleaseOutside = function () {
    Very simple, was wondering how when I drag it I can give it a bit of a tweening affect, so when you let go it still moves and slow down to a stop... Also I want to have a reset button, that when clicked brings the MC back to the original position the MC was in during the inital first play... Can this be done?

  2. #2
    Join Date
    Mar 2007
    Currently: New York/Philadelphia
    Thanked 519 Times in 507 Posts


    I'll answer your second question first...

    Yes this can be done.

    Is the position where you would like it to start exact? Meaning can you pinpoint the exact coordinates of where you would like it to begin? If so, it's quite simple...

    Simply add the _x and/or _y properties to those coordinates within the reset function. Something like this:

    btn_reset.onRelease = function() {
    movieclip._x = startingpoint;
    movieclip._y = startingpoint;
    if the coordinates of your MC are fluid and/or dynamic, its much the same princple, you'll just need to use some logic to pinpoint where the MC needs to go.

    As far as your second question, I wouldn't use the startDrag/stopDrag functions for that purpose. I would use a tween engine (MCTeen, Fuse, or even the Tween class if you're not familiar with those).

    Basic logic:
    on Mouse press the MC moves in accordance with the x and y coordiantes of the mouse. on release, the MC is tweened +/- a certain amount of pixels using the "back" or "bounce" tween.

    Let me know if you have any questions.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts