Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

code snippet not working

Explorer ,
Jan 26, 2019 Jan 26, 2019

i tried to add simple touch and drag code snippet to a symbol for air to ios.

when testing app on iphone x it doesn't work. why?

/* Touch and Drag Event

Allows the object to be moved by holding and dragging the object.

*/

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

green.addEventListener(TouchEvent.TOUCH_BEGIN, fl_TouchBeginHandler_2);

green.addEventListener(TouchEvent.TOUCH_END, fl_TouchEndHandler_2);

var fl_DragBounds_2:Rectangle = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);

function fl_TouchBeginHandler_2(event:TouchEvent):void

{

event.target.startTouchDrag(event.touchPointID, false, fl_DragBounds_2);

}

function fl_TouchEndHandler_2(event:TouchEvent):void

{

event.target.stopTouchDrag(event.touchPointID);

}

556
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 26, 2019 Jan 26, 2019

try event.currentTarget instead of event.target

Translate
Community Expert ,
Jan 26, 2019 Jan 26, 2019

try event.currentTarget instead of event.target

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 30, 2019 Mar 30, 2019
LATEST

i thought its ok but still not working:

/* Touch and Drag Event

Allows the object to be moved by holding and dragging the object.

*/

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

sechvi.addEventListener(TouchEvent.TOUCH_BEGIN, fl_TouchBeginHandler_2);

sechvi.addEventListener(TouchEvent.TOUCH_END, fl_TouchEndHandler_2);

var fl_DragBounds_2:Rectangle = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);

function fl_TouchBeginHandler_2(event:TouchEvent):void

{

event.currentTarget.startTouchDrag(event.touchPointID, false, fl_DragBounds_2);

}

function fl_TouchEndHandler_2(event:TouchEvent):void

{

event.currentTarget.stopTouchDrag(event.touchPointID);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 02, 2019 Feb 02, 2019

thank you

correct

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 02, 2019 Feb 02, 2019

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines