1 Reply Latest reply on Jul 29, 2006 8:44 AM by kglad

    Reseting Movie

      Help PLEASE!!!

      I am producing a display screen that displays information. The information is loaded by attaching a movie (single line display) and then loading the data. There can be 1 to ? of these attached movies. The number of entries in an Array decides the total number. See Code:

      function LoadDisplay() {
      newY = (Number(_level0.cart.length)-1)*22;
      for (l=(Number(_level0.cart.length)-1); l>-1; --l) {
      var MD:Number = display_mc.getNextHighestDepth();
      if (MD == 0) {
      MD = 1;
      tempName = "entry"+l+"_mc";
      display_mc.attachMovie("Entry", tempName, MD);
      eval("display_mc.entry"+l+"_mc").Name_txt.text = _level0.cart[l].PName;
      eval("display_mc.entry"+l+"_mc").Stock_txt.text = _level0.cart[l].Stock;
      eval("display_mc.entry"+l+"_mc").Qty_txt.text = _level0.cart[l].Qty;
      eval("display_mc.entry"+l+"_mc").Price_txt.text = _level0.cart[l].Price;
      eval("display_mc.entry"+l+"_mc").Sale_txt.text = _level0.cart[l].Sale;
      eval("display_mc.entry"+l+"_mc").Sale_txt._visible = false;
      eval("display_mc.entry"+l+"_mc").CNum_txt.text = l;
      if (Number(_level0.cart[l].Sale)<=0 || isNaN(_level0.cart[l].Sale) == true) {
      eval("display_mc.entry"+l+"_mc").Total_txt.text = Number(_level0.cart[l].Price)*Number(_level0.cart[l].Qty);
      } else {
      eval("display_mc.entry"+l+"_mc").Total_txt.text = Number(_level0.cart[l].Sale)*Number(_level0.cart[l].Qty);
      eval("display_mc.entry"+l+"_mc").Sale_txt._visible = true;
      if (_level0.cart[l].CBAV == "") {
      //eval("display_mc.entry"+l+"_mc").Option1_cb._visible = false;
      if (_level0.cart[l].CBBV == "") {
      eval("display_mc.entry"+l+"_mc").Option2_cb._visible = false;
      eval("display_mc.entry"+l+"_mc")._visible = true;
      eval("display_mc.entry"+l+"_mc")._y = newY;
      eval("display_mc.entry"+l+"_mc")._x = 155;
      newY = newY-22;

      The attched movie has ComboBoxes so I need to load from the bottom up. This will insure that the first display is on a higher level then the one below it. If I load from the top down the dropdown goes under the lower movies and the user can not see or select the data.

      Anyway, this process works fine the first time the display is loaded. The problem accurs on the second, third, etc. viewing of the form. There seems to be a rogue attached movie that is loaded in the wrong place and I can't get rid of it.

      I have tried to unload the display_mc and reload it. This makes a unique error: every other time the movie is displayed it works.

      Each time I need to dispay the movie I need to clear and reload. Any suggestions???

        • 1. Re: Reseting Movie
          kglad Adobe Community Professional & MVP
          don't use getNextHighestDepth() with components. many are poorly coded and occupy the greatest depth at which a movieclip can be removed via actionscript.

          to remedy, use a initialize, use and increment a variable that contains the value of the depth to use for your attached movie.