Preventing double playing of a MovieClip
Posted on 2004-11-06
I have a simple timeline setup:
Layer 1 - Actions
Layer 2 - An instance of a button that takes up the entire stage
Layer 3 - An instance of a Movie Clip
The movie Clip instance contains only audio.
The situation is I would like to simulate a Voice Response system in which the user clicks on the button (a graphic of a phone) and hears the correct voice response prompt (this is the audio contained in the movie clip instance)
My timeline is 10 frames long with a stop(); action in frame 1
The following code is attached to the button:
Frame 5 contains a keyframe on the movieclip layer and I have placed an instance of the movieclip on te stage at that frame.
This works ok, when I click the button the audio plays...the problem is....everytime I press the button a new instance of the audio plays...how can I check to see if an instance of the audio is playing and do one of two things on a button click:
1. If no audio playing on button click - play audio (movieclip)
2. If audio is playing(movieclip) - restart the audio movieclip.
I appreciate any help on this.