Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add startDrag & stopDrag methods for Sprites #37

Closed
PrimaryFeather opened this issue Oct 3, 2011 · 12 comments
Closed

Add startDrag & stopDrag methods for Sprites #37

PrimaryFeather opened this issue Oct 3, 2011 · 12 comments
Labels

Comments

@PrimaryFeather
Copy link
Contributor

No description provided.

@illuzor
Copy link

illuzor commented Feb 8, 2014

So long time... We need this feature!

@fljot
Copy link

fljot commented Feb 8, 2014

@illuzor useful troll mode why startDrag() but not startBlink()?

@PrimaryFeather
Copy link
Contributor Author

Wow, it's been a while since I opened up that issue! ;-)
Since I never got any feedback of developers requiring it, it's quite low down in my priorities-list, though I still think it would be useful.

However, I recommend you have a look at the "TouchSheet" class that's used in the Starling Demo. It implements a complete multi-touch-enabled drag solution (plus pinch and rotate), so it's for sure a good starting point for what you want to achieve.

@illuzor
Copy link

illuzor commented Feb 11, 2014

PrimaryFeather, thank you for answer.
Of course task may be solved via many ways, but built-in feature will be much more comfortable.

@PrimaryFeather
Copy link
Contributor Author

Of course! I just want to avoid that you have to wait for me to implement this before you can continue. ;-)

@illuzor
Copy link

illuzor commented Feb 11, 2014

I have solved the task. I am understand that implementation can`t be immediate.
We are just waiting. Thank you!

@Eketol
Copy link

Eketol commented May 24, 2016

Still waiting :)

@22Round
Copy link

22Round commented May 24, 2016

+1 for waiting

@PrimaryFeather
Copy link
Contributor Author

I must say I'm no longer sure this is really necessary, since dragging can be achieved as simple as the following:

sprite.addEventListener(TouchEvent.TOUCH, onTouch);

private function onTouch(event:TouchEvent):void
{
    var target:DisplayObject = event.target as DisplayObject;
    var touch:Touch = event.getTouch(target, TouchPhase.MOVED);

    if (target && touch)
    {
        var movement:Point = touch.getMovement(this);
        target.x += movement.x;
        target.y += movement.y;
    }
}

This was more complicated in the past, when there was no getMovement() method. But now — it seems very simple; and most of the time, you need to adapt the code somehow, anyway, so the default implementation wouldn't cut it for you.

Are there more opinions on this?

@illuzor
Copy link

illuzor commented May 24, 2016

I`m agree. No need for dragAndDrop now

@Eketol
Copy link

Eketol commented May 25, 2016

Thanks PrimaryFeather, that worked for me!

@PrimaryFeather
Copy link
Contributor Author

Perfect, thanks for the feedback!
I'll close this issue then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants