title: Actionscript 3 Reference to public static var in array not working
body: <p>I'm setting up a class of public static vars that are to be BitmapData.</p>
  
  <p>The problem I'm having is I can't seem to reference the vars dynamically in an array, making it impossible to give them values without some serious procdedural style coding. </p>
  
  <p>This is what it looks like</p>
  
  <pre><code>package com.myPackage{
  
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
  
      public class Images extends Sprite{
  
         private var url1:String = "http://www.mydomain.com/myImage.jpg";
         private var url2:String = "http://www.mydomain.com/myImage2.jpg";
  
         public static var IMAGE_ONE_BDATA:BitmapData;
         public static var IMAGE_TWO_BDATA:BitmapData;
  
         private var urlArray = new Array(url1,url2);
         private var bDataArray = new Array(IMAGE_ONE_BDATA, IMAGE_TWO_BDATA);
         private var count:int = 0;
  
         public function Images(){
           initLoader();
         }
  
         private function initLoader():void
         {
            if(count &lt; urlArray.length){
              var url:String = urlArray[count];
              var loader:Loader = new Loader();
              loader.load(new URLRequest(url));
              loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function (e:Event):void{
              bDataArray[count] = e.target.content.bitmapData;
              trace(IMAGE_ONE_BDATA) // &lt;-- this should trace ([object-bitmapdata]) but instead returns null.. this is where I have to make a direct reference like..
              IMAGE_ONE_BDATA = e.target.content.bitmapData;
              trace(IMAGE_ONE_BDATA) // &lt;-- will now return my bitmapdata object
  
              count++;
              initLoader();
             }else{
              dispatchEvent(new ImagesLoadedEvent);
         }
      }
   }  
  </code></pre>
  
  <p>Should I assume it's because my array is a private var and placing references to public static vars is illegal?  Is somebody gonna call the flash police on me?<br>
  Any input highly appreciated.</p>
  
  <p>-Jascha</p>