title: AS3 Casting one type to another
body: <p>I have a base class called <code>Room</code> and a subclass called <code>Attic</code>, and another called <code>Basement</code>.</p>
  
  <p>I have a controller class that has an attribute called <code>CurrentLocation</code> which is type <code>Room</code>.  The idea is I want to be able to put <code>Attic</code> or <code>Basement</code> in that property and get it back, then cast that to whatever type it is.</p>
  
  <p>So if on the controller the content is of type <code>Attic</code>, I'm trying to figure out how to explicitly cast it.  I thought I knew but its not working...  Here's what I thought it would be, borrowing from Java:</p>
  
  <pre><code>var myAttic:Attic = (Attic) Controller.CurrentLocation;
  </code></pre>
  
  <p>This gives me a syntax error:</p>
  
  <blockquote>
    <p>1086: Syntax error: expecting semicolon before instance.</p>
  </blockquote>
  
  <p>So how do you cast implicitly?  Or can you?  I could swear I've done this before as as3.</p>