Hi all,

I am creating a simulation of a 'smart' shower screen which has various modules - "duringShowering", "create Profile", "temperature and" "outlet" and "flow"

When a user arrives "create Profile" module if he clicks the main button once (onRelease) he skips onto and selects the next module which in this case is "outlet" module where he can change from shower to drench. The modules are assigned to different frame labels on the timeline.
However if he presses and holds the main button for 5 seconds the user is taken to another frame
where he can program a new profile and setup the water temperature, flow and timer etc.

In essence the code below allows me to do this just fine but only ONCE as i click through the five modules.
However if i click through all the modules again (loop) for the 2nd or 3rd time
then the code seems to break and the button loses the "dual" functionality.
Mostly the onPress functionality continues to work BUT the onRelease seems to fail and when i click i cannot skip to the "outlet" module.
This happens when i revisit the same code as i click through the modules on a 2nd or 3rd
loop around the animation. Pretty frustrating as need to give a demo this Friday!

I would be grateful if someone could have a look at the code below
and possibly identify if there are any fixes that i can apply to make it more stable,
and so that it can loop without breaking.
I have a suspicion that "clearInterval(intervalID)" might have a lot to do with it.

Many thanks

Guy


stop();
var miniTime = 0;
var intervalID:Number;
joggleAnimation.button01.onPress = function() {
function callback() {
miniTime = getTimer();
}
intervalID = setInterval(callback, 500);
};


joggleAnimation.button01.onRelease = function() {
if (miniTime<500) {
gotoAndPlay("outlet");
trace("outlet1");

} else {
gotoAndPlay("createProfile");
trace("createProfile1");

}
clearInterval(intervalID);
miniTime = 0;
};