Mailing List
Home
Forum Home
Flash Pro
Subjects
Subject: RE: Firework Effect
Web Service Results
Flash Interface with 10mb xml file
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash MX 2004 Sucks
Reading and displaying RSS feeds in Flash MX
Flash and QuickTime VR
Textfield prototype question
XML to Object help
Order of events per frame
MX2004 Dataset itemClassName
memory management removeMovieClip /
Event Dispatcher between classes
Help: MX 2004 How to script a print button to print the entire sli
ScrollPane component doesn 't auto update
setInterval bug identified and fixed
setInterval bug identified and fixed
Listener Object 's best practice
 
detecting a held button

detecting a held button

2004-03-05       - By Andreas Weber

 Back
Reply:     1     2     3     4     5     6     7     8     9     10  

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)