Here's my code:
Expand|Select|Wrap|Line Numbers
- function getSound(url:String) {
- sound.stop();
- delete sound;
- sound = new Sound();
- sound.loadSound(url, true);
- }
- function audioStop() {
- sound.stop();
- $marker = sound.position/1000;
- $state = false;
- _root.animation.gotoAndStop(1);
- }
- function audioPlay() {
- sound.start($marker);
- $state = true;
- _root.animation.play();
- }
- function checkState() {
- if ($state == true) {
- audioStop();
- }
- else {
- audioPlay();
- }
- }
- getSound("urlofaudio.mp3");
- sound.stop();
- var $state = false;
- var $marker = 0;
- trigger_btn.onRelease = checkState;
Any help would be appreciated.
Thanks in advance!