Skip to main content
Participant
March 1, 2007
Question

Play Pause sound in flash 8

  • March 1, 2007
  • 4 replies
  • 635 views
I really need someons help. I am still learning actionscript, but need a job completed by Monday.
I got the following script from O'Reilly's web site:
http://www.oreillynet.com/pub/a/javascript/excerpt/ActionScriptCkbk_chap1/index1.html?page=1

However, the sound does not pause at all, it just continues to play.
I have imported the sound file and added the linkage.

...code attached.

Thank you in advance.


This topic has been closed for replies.

4 replies

kglad
Community Expert
Community Expert
March 2, 2007
that's not very impressive coding. the pause method is totally superfluous and adds nothing to the already existant stop() method.

the resume prototype adds a little functionality to the start() method, but not much.

in any case, there are no errors in that coding and your sound should stop/pause and resume as long as those prototype methods are defined before they are used.

so, what's calling the pauseSound() function and failing to pause your sound?
Inspiring
March 1, 2007
You should be able to adapt the code you've got. Search the ActionScript2
book in the help files for "Loading an MP3 file."


cf_junkyAuthor
Participant
March 1, 2007
Yes there was some code that I somehow overlooked.
I added it in and now it works perfectly.

Sound.prototype.pause = function ( ) {
// Get the current position and then stop the sound.
this.pauseTime = this.position;
this.stop( );
};

Sound.prototype.resume = function ( ) {
// Start the sound at the point at which it was previously stopped.
this.start(this.pauseTime/1000);
};


Thank you so much for the prompt reply.

I see I have a second challege and that is I need to keep the base file small and rather call the sound externally. They are mp3's.

Is it possible to use the code form O'Reilly or do I need a different approach?

kglad
Community Expert
Community Expert
March 1, 2007
you're missing some code. there must be something that extends the sound class' methods to include a pause() and resume() method. do you have that code from o'reilly's?