detecting a held button 2004-03-05 - By Andreas Weber
Back The 'held-button' was really only because someone specifically asked for this behavior.
I guess in most situations a 'double-click' versus 'single-click' would be more intuitive for the users. (the 'held-button' code is changed a bit, the getTimer() is unnecessary)
Find the code for both below.
HTH -- ---- ------ Andreas Weber motiondraw.com
// double-click or single-click?
limit = 200; clicked = 0;
myButton2_mc.onPress = function(){ clicked ++; if(clicked == 1){ int1 = setInterval(test2, limit) } } myButton2_mc.onRelease = function(){ // whatever }
function test2(){ if(clicked == 1){ trace('do the one-click thing'); }else{ trace('do the double-click thing'); } clicked = 0; clearInterval(int1); }
// if pressed longer than a certain time // do something else than if clicked only shortly limit = 200; myButton1_mc.onPress = function(){ released = false; int1 = setInterval(test, limit) } myButton1_mc.onRelease = function(){ released = true; }
function test(){ if(released){ trace('do the short thing'); }else{ trace('do the long thing'); } clearInterval(int1); }
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Supported by Fig Leaf Software -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Lower Prices for Certified Training! Check out new lower prices for Certified Macromedia Training from Fig Leaf Software. Expand your skill set with courses in ColdFusion, Flash, Rich Internet Applications and .NET in the new year. Fig Leaf Software provides the highest caliber instruction at our training centers in Washington D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location.
Get the details at http://training.figleaf.com/ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected) For additional commands, e-mail: flashnewbie-help@(protected)
|
|