Close, do:

snd = new Sound(this);

----- Original Message ----- 
From: "Tom Fitzpatrick" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, July 05, 2005 5:13 PM
Subject: [flexcoders] embedded sounds


I'm trying to embed a number of mp3 sounds and play them back in various 
ways.

The first way is to select the sound names from a comboBox. It's not 
working.

So, for an embedded sound defined as:

[Embed('beki1A.mp3')]
var beki1A:String;

I've defined the following function;

          var snd:Sound;

function startSound(currentSound)
{
            snd = new Sound;
snd.attachSound(currentSound);
snd.start();
}

If I call this function with a button click, like this:

<mx:Button label="Start" id="b1" click="startSound(beki1A);" />

it works fine.

If I pass the value of "currentSound" from a comboBox, with the following
function specified as the change event of the comboBox:

function playSong()
{
var currentSound= songComboBox.selectedItem.label;
startSound(currentSound);
}

it does not work.

When I trace the value of "beki1A" in the buttonclick version, it has a
resource prefix - and this appears to be "lost" when it's assigned to
another variable via the comboBox. Or is it something even simpler?

Where am I going wrong?

- Tom






--
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