Skip to main content
Participating Frequently
November 26, 2013
Answered

add pause in this code....help!!!!

  • November 26, 2013
  • 1 reply
  • 841 views

hi everybody!!!

i'm writing code for up and down speed of song....

for play of song i write this code:

public function playMC(evt:MouseEvent😞void
       
{
            target
= new ByteArray();
           
var url:URLRequest = new URLRequest("C://song.mp3");
            mp3Start
= new Sound();
            mp3Start
.addEventListener(Event.COMPLETE, complete);
            mp3Start
.load(url);


            position
= 0.0;
            rate
= 1.0;
            sound
= new Sound();
            sound
.addEventListener(SampleDataEvent.SAMPLE_DATA, sampleData);
           
       
}
public function complete(event:Event😞void
       
{
            channel
= sound.play();
       
}

this code is good for only play and stop song....i want add pause song....how to do??

help me please!!!!

This topic has been closed for replies.
Correct answer Ned Murphy

There is no pause function.  What you need to do is stop the sound and remember where you stopped so that when play is resumed you specify where to start.  Here is a help document that explains it:

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d12.html

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
November 26, 2013

There is no pause function.  What you need to do is stop the sound and remember where you stopped so that when play is resumed you specify where to start.  Here is a help document that explains it:

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d12.html

rabbit78Author
Participating Frequently
November 26, 2013

thank's very much!!!!!!

i haven't think to resume play....

thank's!!!!

Ned Murphy
Legend
November 26, 2013

You're welcome