Return to Snippet

Revision: 39722
at February 1, 2011 23:53 by adrianparr


Updated Code
import flash.utils.getDefinitionByName;

var SoundRef:Class = getDefinitionByName("MySound") as Class;
var _sound:Sound = new SoundRef();
_sound.play();

Revision: 39721
at January 20, 2011 03:55 by adrianparr


Initial Code
var SoundRef:Class = getDefinitionByName("MySound") as Class;
var _sound:Sound = new SoundRef();
_sound.play();

Initial URL
http://evolve.reintroducing.com/2009/08/03/tips-n-tricks/tip-convert-an-object-to-a-class-by-name/

Initial Description
Here is an example of a sound that is in a library with the class field set to MySound.

Initial Title
AS3 Convert An Object To A Class By Name

Initial Tags
class, object, convert

Initial Language
ActionScript 3