title: How to decode and cast JSON string in Flex?
body: <p>I'm using <a href="http://code.google.com/p/as3corelib/" rel="noreferrer">as3corelib</a> to decode/encode JSON strings. In my little experiment I want to encode 
  an object (<code>UserInfo</code>) to JSON string and decode it back to the object, however it seems to fail at the convertion point (the last line), why would that happen? how can I make it work?</p>
  
  <h3>The <code>UserInfo</code> class</h3>
  
  <pre><code>public class UserInfo
  {
      public var levelProgress    : int;
  }
  </code></pre>
  
  <h3>The conversion code</h3>
  
  <pre><code>var user1:UserInfo = new UserInfo() 
  user1.levelProgress = 20;
  
  var a:String = JSON.encode(user1);
  var b:Object = JSON.decode(a);
  var c:UserInfo;
  
  c = b as UserInfo;  // c gets null, why?
  </code></pre>