AS3 Convert An Object To A Class By Name


/ Published in: ActionScript 3
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. import flash.utils.getDefinitionByName;
  2.  
  3. var SoundRef:Class = getDefinitionByName("MySound") as Class;
  4. var _sound:Sound = new SoundRef();
  5. _sound.play();

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.