0 Replies Latest reply on May 10, 2007 1:28 PM by vectorhog2

    problem with targeting an attachedmovie

    vectorhog2
      I have a flash movie which loads an xml file and then uses a function to populate the text fields of attached movieclips.
      Here's that function:


      var Vthumbs:XML = new XML();
      Vthumbs.ignoreWhite = true;
      var childItems:Array = new Array();
      var itemNames:Array = new Array()
      // After loading is complete, trace the XML object.
      Vthumbs.onLoad = function(success) {
      _root.user_txt.text = Vthumbs.firstChild.attributes.user;
      _root.pass_txt.text = Vthumbs.firstChild.attributes.password;

      childItems = Vthumbs.firstChild.childNodes;
      totalItems = childItems.length+1;

      for (var i:Number = 0; i < totalItems; i++) {
      attachMovie("itemClip","nextItem" + i, i, {_x:10, _y:i*160,
      tFile:childItems .firstChild.attributes.file,
      flvFile:childItems
      .firstChild.attributes.svideo,
      mpgFile:childItems .firstChild.attributes.dvideo,
      titleT:childItems
      .firstChild.firstChild.firstChild.firstChild.nodeValue,
      descT:childItems .firstChild.firstChild.firstChild.nextSibling.firstChild.nodeValue,
      num:i});


      _root.sp.setScrollProperties(_root.sp.content._width,1,_root.sp.content._height,1);
      }
      }


      Vthumbs.load("thumbs4.xml");

      This is working fine. My problem comes with getting the data back from the attached movie clips. I can't seem to access them using a simlar loop. Here's the code:


      function submit() {

      _root.user_txt.enabled = false;
      _root.pass_txt.enabled = false;

      //loop thru itemc and populate array
      for (var i:Number = 0; i < totalItems; i++) {

      trace("submit test looped "+ ["nextItem"+i].tFile_txt.text); //this outputs undefined
      trace("submit test on item 0 "+ nextItem0.tFile_txt.text); //this outputs what ever is currently in the textfield


      }
      }

      Is there something wrong with my syntax? Why is the ["nextItem"+i].tFile_txt.text coming out as undefined, while nextItem0.tFile_txt.text) is working fine? I would really appreciate any help you can offer.

      David Aronson
      vectorhog productions