title: ActionScript 3 - Define and construct a class from a variable
body: <p>I'm trying to easily add in some dynamic attributes to a few variables that I construct at the beginning of my movie clip. </p>
  
  <p>The variable is called with the line:</p>
  
  <pre><code>var clipToUse:CustomClip = new CustomClip();
  </code></pre>
  
  <p>I need to replace the CustomClip class (which is created in the library) with a variable that's changes earlier in the function. I tried setting a variable and then using the root[variable] command, which threw an error saying that a semicolon was expected on the right bracket. </p>
  
  <p>I'm at my wit's end trying to get this custom class to be defined by a variable.</p>