3 Replies Latest reply on Oct 12, 2007 8:12 AM by kglad

    call duplicatemovieclip from another movieclip weird problem

    Starlover_jacob Level 1
      hello i have noticed a weird thing with duplicatemovieclip.
      Let me explain what my problem is:

      i used a movieclip called mf_instance for a menu. Inside this movieclip is an movieclip called btn2 with a text home on it.

      when i use the following code inside the movieclip mf_instance i get nicely 5 buttons beneath each other.
      code:
      -------------------------------------------------------------------
      createButtons();
      function createButtons()
      {
      var totalitems=5;
      for(i=0; i<totalitems; i++)
      {
      var test:Number=((btn2._height+3)*i) + (btn2._y+btn2._height+10);
      duplicateMovieClip(btn2,"button"+i, this.getNextHighestDepth());
      this["button"+i]._x = btn2._x;
      this["button"+i]._y =test;
      this["button"+i].btntxt.text = i;
      }
      }
      -------------------------------------------------------------------

      Now my problem:
      I have all my code at one place so i don't have to look where all bits and pieces of my code are.
      so i call the same function and use _parent.mf_instance to get to my menu.
      the problem i have is that when i trace the y position of each duplicated button it gives me different values but my buttons look stacked on top of each other.

      used code:
      -------------------------------------------------------------------

      //createButtons();
      function createButtons()
      {
      var totalitems=5;
      for(i=0; i<totalitems; i++)
      {
      var test:Number=((_parent.mf_instance.btn2._height+3)*i) + (_parent.mf_instance.btn2._y+_parent.mf_instance.btn2._height+10);
      duplicateMovieClip(_parent.mf_instance.btn2,"button"+i, this.getNextHighestDepth());
      _parent.mf_instance["button"+i]._x = _parent.mf_instance.btn2._x;
      _parent.mf_instance["button"+i]._y =(_parent.mf_instance.btn2._height+3)*i;
      //eval(_parent.mf_instance["button"+i])._y =test;
      _parent.mf_instance["button"+i].btntxt.text = i;
      }
      }
      -------------------------------------------------------------------

      can anyone help me solve this weird problem?