11 Replies Latest reply on Nov 30, 2006 11:53 AM by kglad

    problem creating dynamic instances of a component

    cakewalkr7
      I have created a component called tab which I'm using in another movie. In the main movie, the linkage identifier for the tab component is called tab. I'm trying to create an empty movie clip and then create a dynamic amount of instances of this tab component and attaching them to the empty movie clip but it's not quite working. It is creating an instance fo the component, but I can't figure out how to set the properties of the component such as it's x coordinate or any of the defined parameters I created when building the component. Here's the script I have... can anyone see why it's not working? Thanks.


      function SetupTabs()
      {
      var tabs = new Array("tab1", "tab2", "tab3", "tab4"); //tmp array
      createEmptyMovieClip("container",0);
      var prevTB:Object; //used for position - copy of previous tab object

      for (i = 0; i < tabs.length; i++)
      {
      initOb = {BGColor:"0x37527E",FontColor:"0xFFFFFF",Link:"test.htm",LinkTitle:tabs ,OverBGColor:"0x990000",OverTextColor:"0x000000"}; //initObject parameters for tab object
      var tb:Object = container.attachMovie("MM_Tab", "tab" + i, i, initOb);
      container._x = 65;

      if (i > 0)
      tb._x = prevTB._x + prevTB.Width; //position current tab to the right of previous tab
      else
      tb._x = 75;

      prevTB = tb;
      }
      }