-
[RESOLVED] As3 iOS only drag parent MC
Hi
When I target my main MC on the stage making it draggable, its nested MCs (its children) also becomes draggable? Is there a way to prevent this?
I have an MC called "zoo" and I use the following code:
Code:
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
var fl_DragBounds:Rectangle = new Rectangle(0, 0, 500, 500);
zoo.addEventListener(TouchEvent.TOUCH_BEGIN, zoo_TouchBeginHandler);
zoo.addEventListener(TouchEvent.TOUCH_END, zoo_TouchEndHandler);
function zoo_TouchBeginHandler(event:TouchEvent):void
{
event.target.startTouchDrag(event.touchPointID, false, fl_DragBounds);
}
function zoo_TouchEndHandler(event:TouchEvent):void
{
event.target.stopTouchDrag(event.touchPointID);
}
Any way to ONLY make the parent MC draggable? (of course the nested MCs should follow the "zoo" MC when I drag it - so they should be "fixed" in the "zoo" MC).
Cheers.
-
Not sure what the issue is from your question.
Yes, any move you make to myMC will move everything in myMC. If you have a movieclip mySquare in myMC, myMC.mySquare will move with myMC. If myMC.x = 0, and myMC.mySquare.x = 0, then you move myMC from 0 to 78433, myMC.mySquare.x is still 0.
Last edited by moot; 03-25-2014 at 01:15 PM.
-
Found a solution.
Hi
The problem was that each child also became draggable
So I tried stopPropagation() but with no luck.
I used event.currentTarget instead of event.target, and it worked. I can now drag (only) the zoo MC, but not its children.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|