1 Reply Latest reply on Nov 15, 2007 6:23 AM by joeflashTO

    Problem using variables to fill textbox

    pope on acid
      What's wrong?

      When I run:

      import flash.events.Event;
      import flash.net.URLLoader;
      import flash.net.URLRequest;

      var i;
      var externalXML:XML;
      var loader:URLLoader = new URLLoader();
      var request:URLRequest = new URLRequest("configuratie.xml");
      loader.load(request);
      loader.addEventListener(Event.COMPLETE, onComplete);

      function onComplete(event:Event):void
      {
      var loader:URLLoader = event.target as URLLoader;
      if (loader != null)
      {
      externalXML = new XML(loader.data);
      for(i=1;i<=6;i++){
      var movBV = "BV" + i;
      [movBV]vak.text = externalXML.blokveld .attribute("producten");
      }
      }
      else
      {
      trace("XML Bestand niet gevonden!");
      }
      }

      I get:

      1120: Access of undefined property vak.
      [movBV]vak.text = externalXML.blokveld
      .attribute("producten");

      This works fine:
      movBV1.vak.text = externalXML.blokveld .attribute("producten");