-
Drag/drop on Long Press Event
Hi there,
I'm looking for some help on what I imagine is a pretty simple piece of code.
I have a drag and drop function, below:
---------
skittles.addEventListener(MouseEvent.MOUSE_DOWN, startDragging01);
function startDragging01(event:MouseEvent):void
{
skittles.startDrag();
}
skittles.addEventListener(MouseEvent.MOUSE_UP, stopDragging01);
function stopDragging01(event:MouseEvent):void
{
skittles.stopDrag();
}
---------
I wish to use this function with the Long Press Mobile Event . The snippet code is as follows:
---------
/* Long Press
Pressing the object for one second executes a function containing your custom code. You can use this action to display a context menu for that object.
Instructions:
1. Add your custom code on a new line after the lines that say "// Start your custom code" below.
*/
var fl_PressTimer_2:Timer = new Timer(1000);
fl_PressTimer_2.addEventListener(TimerEvent.TIMER, fl_PressTimerHandler_2);
function fl_PressTimerHandler_2(event:TimerEvent):void
{
// Start your custom code
// This example code doubles the object's size
skittles.scaleX = 2;
skittles.scaleY = 2;
// End your custom code
}
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
skittles.addEventListener(TouchEvent.TOUCH_BEGIN, fl_PressBeginHandler_2);
skittles.addEventListener(TouchEvent.TOUCH_END, fl_PressEndHandler_2);
skittles.addEventListener(TouchEvent.TOUCH_OUT, fl_PressEndHandler_2);
skittles.addEventListener(TouchEvent.TOUCH_ROLL_OU T, fl_PressEndHandler_2);
function fl_PressBeginHandler_2(event:TouchEvent):void
{
fl_PressTimer_2.start();
}
function fl_PressEndHandler_2(event:TouchEvent):void
{
fl_PressTimer_2.stop();
// Start your custom code
// This example code resets the object to its original size
skittles.scaleX = 1;
skittles.scaleY = 1;
// End your custom code
}
---------
Any help would be much appreciated
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
|