dimanche 15 janvier 2017

in actionscript 3 how do i calculate the mouse hold time... i am novice in actionscript 3

when i hold down the button less than 2 seconds the button 2 will appear or after i pressing it for more that 2 seconds the button 3 will appear, i am new in actionscript 3, i need some guide.

my code is

bt_1.addEventListener(MouseEvent.CLICK, onClick);
bt_1.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
bt_1.addEventListener(MouseEvent.MOUSE_UP, onUp);
var test1:Number = 0;
var test2:Number = 0;
var test3:Number = 0;
var test4:Number = 0;
function onClick(e:MouseEvent=null):void
{
test1 = getTimer(); 
}
function onDown(e:MouseEvent=null):void
{
test2 = getTimer(); 
}
function onUp(e:MouseEvent=null):void
{
// here i need to calculate the mouse down time so i can show my other button   
// if mouse button pressed less than 2 seconds the bt_2 will show up.
//else bt_3 will show up.   

}

Aucun commentaire:

Enregistrer un commentaire