4 Replies Latest reply on Sep 5, 2007 3:31 PM by Senor_Roberto

    Yet Another Bindable Question

    JeffStraub
      I know there have been quite a few posts surrounding the Bindable tag (I know, I've read them all), but I still can't seem to get it to work and any assistance would be greatly appreciated. The gist of this class is to load external XML data and use that as labels within the app. I've tried to distill my code down to its simplest form to try and access the problem, so here it is:

      package assets{
      import flash.events.*;
      import flash.net.URLLoader;
      import flash.net.URLRequest;

      [Bindable]
      public class ICManager{
      public var icXML:XMLList;

      public var homeLabel:String = "1";

      public function ICManager(){
      var returnData:URLLoader = new URLLoader();
      returnData.addEventListener(Event.COMPLETE, completeHandler);
      returnData.load(new URLRequest("../xml/interfaceContent_EN.xml"));
      }

      private function completeHandler(event:Event):void {
      try {
      icXML = new XMLList(event.target.data);
      homeLabel = "2"
      }catch (e:TypeError){
      //log this error
      }
      }
      }
      }

      And heres the code that instantiates that:

      [Bindable]
      public var interfaceContent:ICManager;

      public function preInit():void{
      interfaceContent = new ICManager();
      }

      Now, ignoring the loading of the XML for a minute, why, in the name of all that is Adobe, would {interfaceContent.homeLabel} render as "1" and not "2"? Eventually homeLabel will be set by the loaded XML, but for problem-solving sake, I'm just expressly setting to try an eliminate problems.

      Again, any help to understand this would be greatly appreciated.