Exactly. Or, if you know the name and you don't need it to be a dynamic
reference, just do...

var snd:MySoundName = new MySoundName();
snd.play();

Where "MySoundName" is the name given to it in the library.

Zeh

On Fri, Feb 13, 2009 at 12:35 PM, Kenneth Kawamoto <
kennethkawam...@gmail.com> wrote:

> There are no "Linkage ID"s in AS3. Class names you are talking about? :)
>
> May be you can do something like:
>
> private function playSound(className:String):void {
>   var ClassRef:Class = getDefinitionByName(className) as Class;
>   var snd:Object = new ClassRef();
>   snd.play();
> }
>
>
> Kenneth Kawamoto
> http://www.materiaprima.co.uk/
>
> Mendelsohn, Michael wrote:
>
>> Thanks for responding Ken, but I'm passing a String (linkage id).  My
>> question is really how to create a new instance of the sound when I only
>> have the linkage identifier as a string?  I can't seem to cast it to a
>> Class.
>>
>> - MM
>>
>> -----Original Message-----
>> From: flashcoders-boun...@chattyfig.figleaf.com
>> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Kenneth
>> Kawamoto
>> Sent: Friday, February 13, 2009 10:18 AM
>> To: Flash Coders List
>> Subject: Re: [Flashcoders] play sound via linkage
>>
>> var snd:LinkedSound = new LinkedSound();
>> snd.play();
>>
>> Kenneth Kawamoto
>> http://www.materiaprima.co.uk/
>>
>>
>> Mendelsohn, Michael wrote:
>>
>>> Hi list...
>>>
>>> Silly AS3 question: how do you play a sound with a linkage identifier?
>>>
>>
>>  public function playSound(linkageID:String):void{
>>>        // these don't work
>>>        var snd:Sound = new Sound(linkageID);
>>>        var snd:* = new Class(linkageID);
>>>        snd.play();
>>> }
>>>
>>> Thanks!
>>>
>>> - MM
>>>
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to