title: AS3: Overriding Proxy getProperty method
body: <p>I've run into a peculiar problem while trying to make use of the <code>Proxy</code> class and override the <code>getProperty()</code> method. I've attached my example class code below:</p>
  
  <pre><code>package
  {
      import flash.utils.Proxy;
      import flash.utils.flash_proxy;
  
      public class Thing extends Proxy
      {
          // holder object
          private var _holder:Object;
  
          /**
           * Constructor
           */
          public function Thing()
          {
              _holder =
              {
                  stuff: "thing"
              };
          }
  
          /**
           * Override getProperty
           */
          override flash_proxy function getProperty(name:*):*
          {
              trace(name + " being accessed");
              return _holder[name];
          }
      }
  }
  </code></pre>
  
  <p>I've been trying to use this to make some properties read-only (as per an answer on a <a href="https://stackoverflow.com/questions/6222713/creating-multiple-read-only-properties-dynamically-in-as3">previous question of mine</a>), however there's some odd behaviour that I can't seem to work out.</p>
  
  <p>Using the above, I try and access the variable <code>stuff</code> like so:</p>
  
  <pre><code>var t:Thing = new Thing();
  trace(t.stuff);
  </code></pre>
  
  <p>However this throws the following error:</p>
  
  <blockquote>
    <p><strong>1119:</strong> Access of possibly undefined property stuff through a reference
    with static type Thing.</p>
  </blockquote>
  
  <p>But if I do this:</p>
  
  <pre><code>trace(t["stuff"]);
  </code></pre>
  
  <p>It works fine. What am I doing wrong?</p>