loadSound will load an mp3 file external to the SWF.

attachSound will play a sound that has been embedded in the SWF file.


----- Original Message ----- 
From: "Jeff Tapper" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Thursday, July 28, 2005 3:10 PM
Subject: RE: [flexcoders] sound problem: onSoundComplete


I'm having no problems with this.  To test, just replace the url variable
with some local sound on your machine.  One key difference to note, im
using loadSound rather than attachSound.  Not sure why that matters, but it
might

<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application
         width="800" height="600"
         xmlns:mx="http://www.macromedia.com/2003/mxml";
         creationComplete="appInit()">

     <mx:Script>
         <![CDATA[
                 var snd:Sound;
         function appInit() {
                 var url = "Simpsons.mp3";
                 startSound(url);
         }
                 function startSound(currentSound){
                         feedback.text += currentSound+" playing now";
                         snd = new Sound();
                         snd.loadSound(currentSound);
                         snd.onLoad = mx.utils.Delegate.create(this,
playSound);
                         snd.onSoundComplete =
mx.utils.Delegate.create(this, soundStopped);

                         snd.start();
                 }
                 function playSound(){
                         snd.start();
                 }
                 function soundStopped(){
                         mx.controls.Alert.show("stopped");

                         feedback.text += " stopping now";
                 }
         ]]>
     </mx:Script>
<mx:Label id="feedback" />
</mx:Application>


At 02:47 PM 7/28/2005, Tom Fitzpatrick wrote:
>Just trying to bump this problem up - still looking for a solution.
>
>I've tried a bunch of different combinations to make the onSoundComplete
>method work, none of which do the trick. The docs - which perhaps were
>repurposed from Flash - make no mention of the scoping issue. Anyone have
>suggestions or a "hello world" level example?
>
>- Tom
>
>At 01:51 PM 7/27/2005, you wrote:
> >Dirk, thanks for the suggestion - but still no luck. Same problem: sound
> >plays, no onSoundComplete execution. Were you able to get this to work?
> >
> >Here's my revised code:
> >
> >           function startSound(currentSound)
> >                   {
> >                          feedback.text += currentSound+" playing now";
> >                          glow.alpha = 100;
> >                          var snd:Sound = new Sound();
> >                          snd.attachSound(currentSound);
> >                          snd.onSoundComplete =
> >mx.utils.Delegate.create(this, soundStopped);
> >                          snd.start();
> >                           }
> >
> >          function soundStopped()
> >                  {
> >                                  glow.alpha = 0;
> >                                  feedback.text += " stopping now";
> >                  }
> >
> >At 09:37 AM 7/27/2005, you wrote:
> > >There's still a scoping problem. Try this:
> > >
> > >function startSound(currentSound) {
> > >   feedback.text += currentSound+" playing now";
> > >   glow.alpha = 100;
> > >   var snd:Sound = new Sound();
> > >   snd.attachSound(currentSound);
> > >   snd.onSoundComplete = mx.utils.Delegate.create(this, soundStopped);
> > >   snd.start();
> > >}
> > >
> > >function soundStopped() {
> > >   glow.alpha = 0;
> > >   feedback.text += " stopping now";
> > >}
> > >
> > >Dirk.
> > >
> > >-----Original Message-----
> > >From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> > >Behalf Of Tom Fitzpatrick
> > >Sent: Wednesday, July 27, 2005 2:26 PM
> > >To: flexcoders@yahoogroups.com
> > >Subject: RE: [flexcoders] sound problem: onSoundComplete
> > >
> > >Matt - I made your modification in my code, and still have the same
> > >problem: sound plays OK, but the onSoundComplete actions (trace and
> > >reset
> > >alpha) never take place.
> > >
> > >Here's the modified code:
> > >
> > >           function startSound(currentSound)
> > >                  {
> > >                          feedback.text += currentSound+" playing now";
> > >                          glow.alpha = 100;
> > >                          var snd:Sound = new Sound();
> > >                          snd.attachSound(currentSound);
> > >                          snd.onSoundComplete =
> > >mx.utils.Delegate.create(this, function()
> > >                          {
> > >                                  glow.alpha = 0;
> > >                                  feedback.text += " stopping now";
> > >                          });
> > >                  snd.start();
> > >                          }
> > >
> > >Any other ideas?
> > >
> > >- Tom
> > >
> > >At 09:41 PM 7/26/2005, you wrote:
> > > >snd.onSoundComplete = mx.utils.Delegate.create(this, function() {
> > > >   //same body here
> > > >});
> > > >
> > > >You're having scoping problems.
> > > >
> > > >Matt
> > > >
> > > >
> > > >----------
> > > >From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
> > > >On
> > >
> > > >Behalf Of Tom Fitzpatrick
> > > >Sent: Tuesday, July 26, 2005 2:30 PM
> > > >To: flexcoders@yahoogroups.com
> > > >Subject: [flexcoders] sound problem: onSoundComplete
> > > >
> > > >Trying to get onSoundComplete() to work - but it never seems to get
> > >called.
> > > >
> > > >Here's the code I'm working with:
> > > >
> > > >       function startSound(currentSound)
> > > >       {
> > > >             feedback.text += currentSound+" playing now";
> > > >             glow.alpha = 100;
> > > >                   var snd:Sound = new Sound();
> > > >                   snd.attachSound(currentSound);
> > > >             snd.onSoundComplete = function()
> > > >             {
> > > >                   glow.alpha = 0;
> > > >                   feedback.text += " stopping now";
> > > >             }
> > > >                   snd.start();
> > > >       }
> > > >
> > > >The "currentSound" parameter is the name of an mp3. The startSound
> > > >function is called as the change event from a comboBox used to select
> > > >the sound to be played. The sound gets played just fine, but the
> > > >onSoundComplete function never executes.
> > > >
> > > >The "feedback.text" mechanism is a trace - and the text "stopping 
> > > >now"
> > > >never gets called.
> > > >
> > > >The "glow" object is an imported .swf whose alpha is supposed to 
> > > >change
> > >
> > > >when the sound is complete.
> > > >
> > > >- Tom
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >--
> > > >Flexcoders Mailing List
> > > >FAQ:
> > > ><<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>ht
> tp://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>http:
> > > >//groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > >Search Archives:
> > > ><<http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www
> .mail-archive.com/flexcoders%40yahoogroups.com>http://www.ma
> > > >il-archive.com/flexcoders%40yahoogroups.com
> > > >
> > > >
> > > >
> > > >
> > > >----------
> > > >YAHOO! GROUPS LINKS
> > > >
> > > >    *  Visit your group
> > > >
> "<<http://groups.yahoo.com/group/flexcoders>http://groups.yahoo.com/group/flexcoders>flexcoders"
> on the web.
> > > >    *
> > > >    *  To unsubscribe from this group, send an email to:
> > > >    *
> > > > <mailto:[EMAIL PROTECTED]>fle
> > > > [EMAIL PROTECTED]
> > > >
> > > >    *
> > > >    *  Your use of Yahoo! Groups is subject to the
> > > >
> <<http://docs.yahoo.com/info/terms/>http://docs.yahoo.com/info/terms/>Yahoo!
> Terms of Service.
> > > >
> > > >
> > > >----------
> > >
> > >
> > >
> > >
> > >
> > >
> > >--
> > >Flexcoders Mailing List
> > >FAQ:
> <http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > >Search Archives:
> > ><http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www.ma
> il-archive.com/flexcoders%40yahoogroups.com
> > >Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >--
> > >Flexcoders Mailing List
> > >FAQ:
> <http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > >Search Archives:
> <http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > >Yahoo! Groups Links
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> >--
> >Flexcoders Mailing List
> >FAQ:
> <http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> >Search Archives:
> <http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www.mail-archive.com/flexcoders%40yahoogroups.com
> >Yahoo! Groups Links
> >
> >
> >
> >
>
>
>
>
>
>--
>Flexcoders Mailing List
>FAQ:
><http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>Search Archives:
><http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www.mail-archive.com/flexcoders%40yahoogroups.com
>
>
>
>
>SPONSORED LINKS
><http://groups.yahoo.com/gads?t=ms&k=Computer+software+testing&w1=Computer+software+testing&w2=Macromedia+flex&w3=Development&w4=Software+developer&c=4&s=93&.sig=kh2CguJwmatU5oBXjFo9Rg>Computer
>software testing
><http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Computer+software+testing&w2=Macromedia+flex&w3=Development&w4=Software+developer&c=4&s=93&.sig=dAUcEV7do91-wrRtVS641g>Macromedia
>flex
><http://groups.yahoo.com/gads?t=ms&k=Development&w1=Computer+software+testing&w2=Macromedia+flex&w3=Development&w4=Software+developer&c=4&s=93&.sig=AlxNUQBOI7Io7S7nhmxV0Q>Development
>
><http://groups.yahoo.com/gads?t=ms&k=Software+developer&w1=Computer+software+testing&w2=Macromedia+flex&w3=Development&w4=Software+developer&c=4&s=93&.sig=QWIit8JayomoIHLVkV3FDg>Software
>developer
>
>
>----------
>YAHOO! GROUPS LINKS
>
>    *  Visit your group
> "<http://groups.yahoo.com/group/flexcoders>flexcoders" on the web.
>    *
>    *  To unsubscribe from this group, send an email to:
>    *
> <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
>
>    *
>    *  Your use of Yahoo! Groups is subject to the
> <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
>
>
>----------



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to