Hey everyone,
I'm wondering if someone can help me out with this one. What I want to do is create a button that performs the following:
- press then release = Function1;
- press and hold = Function2;
I have to make it work on a Flash 5 player so using setInterval is unfortunately out. Any suggestions?
Here's what I've tried to do with the button, which ain't workin:
on(press) {
//Set the timer
SetTimer = getTimer();
//Set timer on to true
TimerOn = true;
do {
if (getTimer() < SetTimer+1500){
//wait and do nothing
} else {
//Set timer on to false
TimerOn = false;
//Call Function 2
Function2();
}
} while(TimerOn == true);
}
on(release) {
TimerOn = false;
Function1();
}
The problem I'm getting is that the 'on(release)' action is not happening until the 'do while' statement in the 'on(press)' action evaluates to false. So basically Function2 is executed and then the 'on(release)' actions are executed.
I would be extremely grateful for any help.
Cheers,
Radiostar
I'm wondering if someone can help me out with this one. What I want to do is create a button that performs the following:
- press then release = Function1;
- press and hold = Function2;
I have to make it work on a Flash 5 player so using setInterval is unfortunately out. Any suggestions?
Here's what I've tried to do with the button, which ain't workin:
on(press) {
//Set the timer
SetTimer = getTimer();
//Set timer on to true
TimerOn = true;
do {
if (getTimer() < SetTimer+1500){
//wait and do nothing
} else {
//Set timer on to false
TimerOn = false;
//Call Function 2
Function2();
}
} while(TimerOn == true);
}
on(release) {
TimerOn = false;
Function1();
}
The problem I'm getting is that the 'on(release)' action is not happening until the 'do while' statement in the 'on(press)' action evaluates to false. So basically Function2 is executed and then the 'on(release)' actions are executed.
I would be extremely grateful for any help.
Cheers,
Radiostar