9 Replies Latest reply on Jan 3, 2008 4:53 PM by kglad

    onLoadInit within xml for loop

    leroyh
      Hi,

      I have some code that loads in xml which works fine (see below)

      I have a for loop, and based on the content of the XML, swf's are loaded in to moving clips.

      when each of the swf's have completed loading in I need to change the clips scale, position etc.

      I need to indroduce to the code below some way of detecting when each swf is loaded. I have been doing research and know I need to integrate a loadInit function into the code. I have tried alsorts and looked at alot of code but can't seem to get anything working.

      If any of you can poinbt me in the right direction that would be great.

      stop();
      var y:XML = new XML();
      y.ignoreWhite = true;

      var page_cat_ids:Array = new Array();
      var page_cat_names:Array = new Array();

      y.onLoad = function() {
      var category:Array = this.firstChild.childNodes;
      for (i=0; i<category.length; i++) {
      page_cat_ids.push(category .attributes.cat_id);
      page_cat_names.push(category
      .attributes.cat_name);

      duplicateMovieClip(_root.characterClipContainer.characterClip, "characterClip"+i, _root.characterClipContainer.getNextHighestDepth());
      _root.characterClipContainer["characterClip"+i]._x = 100*i;
      _root.characterClipContainer["characterClip"+i].characterClipName.text = page_cat_names ;
      _root.characterClipContainer["characterClip"+i].characterClipImage.loadMovie("../images/f lash/characters/"+page_cat_names
      +".swf");

      }
      };

      y.load("../xml/categories_page_1.xml");