Jump to content


Photo

stop and play sound


  • Please log in to reply
12 replies to this topic

#1 Booly

Booly

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 22 January 2007 - 05:21 AM

Hi all..
I made this little musicplayer with only a stop and a play in it.
The thing is it will only stop the sound, and not play it again.
I don't know what i did wrong. The code seems fine, the mc has the correct instance name..
Can anyone tell me?

Attached Files



#2 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 22 January 2007 - 08:54 AM

I can't download the file since my internet is running slow, and usually times out when downloading files as largee as 5 megs, but I think you may have your sound set to embed, and not stream. So, you might want to set it to stream ;)

#3 Booly

Booly

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 22 January 2007 - 09:24 AM

No i've set it on stream..
So that's not the prob.
thanks anyway..

#4 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 22 January 2007 - 09:37 AM

Might work better if you create/play it via actionscript. You'll have more control over the audio. Funkysoul has a tutorial on making an MP3 player, you might want to check that out.

#5 Booly

Booly

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 22 January 2007 - 09:44 AM

Ok thanks.. i'll check that one out.. But still i would like to know why this one doesn't work.
Now i've learnt nothing..

#6 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 22 January 2007 - 11:03 AM

You're probably using a stopAllSounds(); function to stop the playback. It wont start back up again until it hits the first frame when the audio starts. If you dont need it synced to anything, put it in its own movieclip, set the audio to stream and try play/stop actions on that mc to control the sound playback.

There, now you can learn that, and how to do it with code ;)

#7 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 22 January 2007 - 07:56 PM

Hopefully they removed the stopAllSounds(); function with Actionscript 3.0. I can't download it yet.

#8 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 23 January 2007 - 03:06 AM

Hopefully they removed the stopAllSounds(); function with Actionscript 3.0. I can't download it yet.


hmm.. nope.. stopAllSounds() has change to stopAll() :)

stopAll () method
public static function stopAll():void

Stops all sounds currently playing.

This method does not stop the playhead. Sounds set to stream will resume playing as the playhead moves over the frames in which they are located.

When using this property, consider the Flash Player security model:

* By default, calling the soundMixer.stopAll() method stops only sounds in the same security sandbox as the object that is calling the method. Any sounds whose playback was not started from the same sandbox as the calling object are not stopped.
* When you load the sound, using the load() method of the Sound class, you can specify a context parameter, which is a SoundLoaderContext object. If you set the checkPolicyFile property of the SoundLoaderContext object to true, Flash Player checks for a cross-domain policy file on the server from which the sound is loaded. If the server has a cross-domain policy file, and the file permits the domain of a SWF file, then the file can stop the loaded sound by using the soundMixer.stopAll() method; otherwise it cannot.



#9 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 23 January 2007 - 03:36 AM

Damn! But seriously has the stopAllSounds/stopAll function been useful ever? Not once have I ever had to use it, and I've made a lot of Flash applications with sound...

#10 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 23 January 2007 - 04:50 AM

hmm.. let me think.. I've used it once or twice..
Eitherway, I'm pretty sure that they took the function to AS3 because it's beeing used. you & me are no reference for them :) There needs to be 100s of people saying to take that function out..

#11 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 23 January 2007 - 05:43 AM

hmm.. let me think.. I've used it once or twice..
Eitherway, I'm pretty sure that they took the function to AS3 because it's beeing used. you & me are no reference for them :) There needs to be 100s of people saying to take that function out..

Yeah I know, but I still don't see why it needs to be used.

#12 Pax

Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 23 January 2007 - 09:32 AM

I use stopAllSounds frequently at work. We have multi-layered content playing at the same time, when you interact with parts of it, we want the sound to stop and start with somthing else, and certian content sections are temporarily removed. Most of our audio is streamed on the timeline, to snyc with animations/graphics and text, so we cant control it well through code.

There are hundreds of different things flash is used for -- its not *just* a web tool. Its used on cell phones, for desktop applications and a whole array of other things. My first project at the company I work at was to design an "Ad Planner" for Mercedes-Benz to use in their dealerships and in newspapers. Done all in Flash + Zinc (although, zinc wasnt powerful enough for what we needed, so we developed our own wrapper for the swf.), it would create pdfs, save them, print them on different sized paper and do all sorts of crazy stuff. My point is that all the methods available in actionscript get used, because flash gets used for so many things, and will only continue to get used for more as it becomes a more viable development language.

#13 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 23 January 2007 - 08:06 PM

Yes.. good argument ;) I suppose it might be used a lot my animators.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users