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: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tom Fitzpatrick
Sent: Wednesday, July 27, 2005 2:26 PM
To: [email protected]
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: [email protected] [mailto:[EMAIL PROTECTED] On
>Behalf Of Tom Fitzpatrick
>Sent: Tuesday, July 26, 2005 2:30 PM
>To: [email protected]
>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>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
>
> * 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]>fle
> [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/