PDA

View Full Version : Attaching an embedded sound using a var



costa
August 3rd, 2007, 11:07 AM
Dear all,

I want to know if it is possible to attach a sound using a variable as the name of the class. For example

Normal way



var mySound:embeddedSound = new embeddedSound ()

What I need



var newSound:string = “embedded Sound”

var mySound:newSound = new mySound()


Is this possible?

Thanks in advance

Reider
August 4th, 2007, 09:53 AM
//Storing the class name
var newSound:String = "EmbededSound"
var mySound:* = new (getDefinitionByName(newSound))
mySound.play()

costa
August 4th, 2007, 11:16 PM
Thanks Reider, I will check it right away