Link to home
Start Free TrialLog in
Avatar of dankazup
dankazup

asked on

Preventing double playing of a MovieClip

Hello.

I have a simple timeline setup:

3 layers
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:
on(release){
   gotoAndPlay(5);
}

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.

Dan
 
ASKER CERTIFIED SOLUTION
Avatar of trigger-happy
trigger-happy
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial