title: AS3 Instantiate Class From External SWF
body: <p>I was chatting with my buddy about this, he is convinced you can do this and says he has done it, but I cannot get this to work.</p>
  
  <p>I am wondering if it is even possible at all. I tried typing a var as a Class that is within the externally downloaded SWF and then making an instance but no can do.</p>
  
  <p>some code</p>
  
  <p><code>private static function onCompleteHandler(e:Event)
  {<br>
      dashboardObject = e.target.content;<br>
          // registerClassAlias("Dashboard", ); doesnt work<br>
      var dash:Class = getDefinitionByName("Dashboard") as Class;<br>
      var myDash = new dash();<br>
      trace(myDash.show);<br>
  }</code></p>
  
  <p>Error</p>
  
  <p><code>ReferenceError: Error #1065: Variable Dashboard is not defined.<br>
      at global/flash.utils::getDefinitionByName()<br>
      at System$/onCompleteHandler()</code>           </p>
  
  <p>So it seems you cannot make an instance of a class unless it is complied within the project SWF. Which if true is what I want it to do. I do not want people trying to make instances of my classes just from downloading the SWF file for what I am building here.</p>
  
  <p>thanks</p>