Check if Class Definiton exists


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



Copy this code and paste it in your HTML
  1. var instance:Sprite;
  2.  
  3. if ( ApplicationDomain.currentDomain.hasDefinition("MyClassName") )
  4. {
  5. var MyClass:Class = getDefinitionByName( "MyClassName" ) as Class;
  6. instance = new MyClass( params ) as Sprite;
  7. }else {
  8. instance = new Sprite( params );
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.