Skip to main content
Participant
June 6, 2006
Question

Making stop and play functions fool-proof

  • June 6, 2006
  • 3 replies
  • 422 views
I have a timeline control embedded into my flash piece. It contains the buttons "Re-Play, Pause, and Play." I am building some testing software, therefore I have instances where the animation/sound stops and waits for the user to select an answer.

At first, I had a problem that, when the user would come to a stop point, they could simply click the play button and the audio would continue (the play button simply held a command like this):


on (press) {
play();
}


So I changed it to an IF statement that looked for a variable before the PLAY button could be pressed. It looks like this:


MP3Player, Frame 1

set ("operator",1);



Play Button

on (press) {
if (operator==1) {
}


if (operator==2) {
play();
set ("operator",1);
}
}




Pause Button

on (press) {
stop();
set ("operator",2);

}



It shows that, in order for Play to work, the user must first PAUSE the flash piece.
The problem therein is that if the user comes to a stop in the timeline, they can simply click PAUSE and then PLAY and continue on the MP3Player element without advancing any of the animation. Is there anyone who can help me fix this? Thanks!
This topic has been closed for replies.

3 replies

June 7, 2006
this is what I think you are trying to do:

the animation stops for a response from the user
It can not be started again by the user until they have responded.

simple,
stop the ani
disable the buttons
the user must select an answer
which triggars the ani to start ( inwhich case you don't need the buttons)
or enables the buttons.

doe that help?
Craig Grummitt
Inspiring
June 7, 2006
//Pause Button

on (press) {
if (operator==1) {
stop();
set ("operator",2);
}
}
tim_ltiAuthor
Participant
June 7, 2006
Thanks for the reply Craig!
I tried that out, but it didn't work...but I think I can see where you are going with it.
Craig Grummitt
Inspiring
June 8, 2006
Sorry - yeah you're right i didn't think that through completely. Use the code I suggested though, and add more code elsewhere. at the moment operator has two states, yeah? 1=playing, 2=paused. You could introduce a third state - 3=quiz(or whatever's going on in your application).

So wherever you have your stop() action on a frame, add the line:
operator=3;

and where the user selects their answer(i am assuming the animation continues on at this point?) and you have a play() action, add the line:
operator=1;

this should give you what you're asking for. the fleece does have a point though, that it would make sense to remove the play/pause buttons altogether during the quiz as they are inactive anyway.

Craig
tim_ltiAuthor
Participant
June 6, 2006
bump