Are you using DragManager? If so, are you getting drag events? I'm not
sure DragManager will work on SpriteVisualElement
Hello, thank you for your reply!
No, I'm not using it. It's not a "real" drag&drop operation, like the one you would carry out when moving data between lists, grids or other flex containers.
I'm merely moving these sprites on the screen using the .startDrag() and .stopDrag() methods defined in the Sprite Class:
I guess you could say that I'm not doing anything else than changing their x and y properties.
Hierarchically, the situation is:
S:ViewNavigatorApplication > s:View > s:Group > s:SpriteVisualElement(s)
It feels like if by applying some effects I make the x and y properties no more available for other subsequent operations, so that I can't move them anymore.
1 person found this helpful
StartDrag/stopDrag are low-level Flash APIs. We don't do any testing of how
they will work with Flex. Our components do their own dragging. There
should be code in Panel, for example.
Oh, I see. Thanks.
So... i should use the "normal" flex drag&drop.
There is just a problem, the documentation says:
The following Flex features are not supported in mobile applications:
No support for drag-and-drop operations
I had to work my way around this limitation one time in the past. I assumed that those lines referred to list-based controls only and I figured that maybe I could manually implement drag&drop with my custom components, which I did. It worked quite well, but unfortunately it also made the mouse cursor appear beneath my fingertip. It was very annoying and I couldn't find a way to get rid of it.
I also thought about implementing the "flex" drag&drop using TouchEvents instead of MouseEvents (maybe that was the cause of the problem, I thought), but the DragManager.doDrag() method requires a MouseEvent as argument.... and that's when I decided to switch to the more basic .startTouchDrag() and stopTouchDrag() methods.
Now, is there something else I could try?
How do other people (more experienced than me) implement their drag&drop mechanics, for starters?
Thank you :-)
.... or I could just make the sprites follow my finger by listening to the TouchMove event.... would that work?
That is roughly what the Panel code does, although it uses MOUSE_MOVE. The
drag/drop support referenced in the doc is probably the DragManager.
Can't find anything illuminating in the s:Panes APIs, or at least nothing more than the usual DragManager-based mechanics.
Well, I think I'll try to simply update the x and y coordinates of my sprites in the TouchMove handler method, and see if this works.
Thank you anyway.
Not in the API, in the source code.
Oh, thank you.
Just read the sources of spark Panel, SkinnableContainer and SkinnableContainerBase. I couldn't find anything, but I'll try to read the other classes in the hierarchy chain before giving up.
Thanks for the tip.
Anyway, manually updating the sprite's coordinates in the MOUSE/TOUCH_MOVE handler sort of works.
The only problem is that it doesn't seem able to keep up with quicker movements, but I think I can fix it by handling the MOUSE_OUT event.
or even better, I can add the eventListener to the view, not the sprite, so that it can keep dispatching the mouse_move events even if the sprite is lagging behind.