actionscript 3 - Make an item disapear when the player touch 2 times the touch screen -


i'm trying make flash game touch screen (android). player can take items , put them in inventory. player can, then, click on item in inventory , drag wants on scene. but, i'd make item disapear of screen when player double tap on screen. moment, player need taps one. (and it's frustrating as, if hasn't put item correct space , wants corrects dragging item again, it's disappearing since clicks on wrong space).

i know have change "removedraggeditem" function, can't figure out how tell want function if player ahs double tap on screen (not 1 click)

here's code. if has idea....

public function itemclick(e:event):void{             inv.draggingitem = false;             var nameofmc:string;             var tempmc;             var draggedname:string = draggeditem.displayname;             if (draggeditem.looktag)                 draggedname = draggedname + draggeditem.looktag;             if (newfriend){                 nameofmc = "action_"+draggedname+"_"+newfriend.displayname;                 //trace ("looking "+nameofmc);                 try {                     tempmc = getdefinitionbyname(nameofmc);                     //trace ("mc found.");                     removedraggeditem();                     if (speech)                         speech.dispatchevent(new event("stoptalking"));                     tempmc = new tempmc;                     playeraction = new playeraction(stageref, draggeditem, newfriend, tempmc, false);                 }                 catch(e){                     //trace ("no mc found.  checking dialog option...");                     try {                         var tempdata = linesdata.dialog[newfriend.displayname].useobject[draggeditem.displayname];                         if (tempdata != "" && tempdata != null){                             //trace ("dialog option found.");                             removedraggeditem();                             alignplayer();                             if (speech)                                 speech.dispatchevent(new event("stoptalking"));                             dialog = new dialog(stageref, newfriend, draggeditem, false);                         }                      }                     catch(e){                         //trace ("no dialog option found.  defaulting player line.");                         alignplayer();                         if (speech)                             speech.dispatchevent(new event("stoptalking"));                         var actionname:string = "use_"+newfriend.displayname;                         if (newfriend.looktag)                             actionname = actionname+newfriend.looktag;                         speech = new speech(stageref, draggeditem, actionname);                     }                  }             } else {                 removedraggeditem();             }          }  private function removedraggeditem():void{             stageref.removeeventlistener(mouseevent.mouse_move, dragitem);             stageref.removeeventlistener(event.enter_frame, itemhittest);             draggeditem.removeeventlistener(mouseevent.click, itemclick);              stageref.removechild(draggeditem);             toolbar.usetext.text = "";              if (stageref.contains(this))                 stageref.removechild(this);              mouse.show();             engine.playercontrol = true;         } 

on first tap set variable (eg screentap) true , set timer maximum amount of milliseconds allow between taps in double-tap. when timer expires reset screentap false.
then, in tap screen handler, check if screentap true. if so, remove item.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -