0 Replies Latest reply on Aug 2, 2006 7:30 AM by chrism59

    Populating ComboBox Values

    chrism59 Level 1
      Here is the issue:

      I writing a store application, in flash, everything is working until I get to the shopping cart. The cart is set to display a single item per line.

      If the item has special options (ie Color, size, shape, etc.), combox(s) are to be made visible so that the use can provide the proper options ( a red shirt and a blue shirt ). If the item has no special options the is one entry line with the total quantity and if the item has special options there it one entry for each itme purchased.

      Because the user may select more items than the display area provided will permit, I am creating 2 movies, one to load the items onto and one as a mask. The item movie scrolls up and down and only the iems in the mask area are displayed.

      lets call the item movie display_mc.

      The display_mc has a movie symbol that is attached and the location set for each item in the shopping cart. The Item movie has 2 ComboBoxes that I want to appear if there are options for the item and to disappear if there are not options. Also if there are options I need to populate the ComboBox with values.

      Everything works up to a point. I can open the cart on a level, loading a MovieClip with ComboBoxes will not work, The Cart Movie creates a display_mc, and Mask_mc. I then loop thru the cart items attaching the Entry movie symbol, set the x and y coordinates, populate the Stock Number, Description, Qty, Price, subtotal (all works like a champ).

      THEN I try to set the ComboBoxes to _visible = false if there are no options or to populate them if there are options. NO CODE I WRITE WILL WORK!!!

      First here is the code:

      if (_level0.cart[ArrLoc].CBAV.length == 0) { //traceing this shows the correct path is executed.
      Option1_cb._visible = false; //setting does not take
      } else {
      Option1_cb._visible = true;
      var Opt1 = _level0.cart[ArrLoc].CBAV;
      if (Opt1.length>0) {
      Option1_cb._visible = true;
      Option1_cb.editable = false;
      //Populate Array
      Option1_cb.addItem(_level0.cart[ArrLoc].CBAL, _level0.cart[ArrLoc].CBAL);
      var comp:Boolean = false;
      var indexCnt:Number = 1;
      var indexVal:Number = 0;
      var matchVal:Number = 0;
      do {
      var endloc:Number = Opt1.indexOf(",");
      if (endloc>-1) {
      var nextItem = Opt1.slice(0, endloc);
      if (nextItem == _level0.cart[ArrLoc].O1) {
      indexVal = indexCnt;
      matchVal = 1;
      Option1_cb.addItem(nextItem, nextItem);
      Opt1 = Opt1.slice(endloc+1, Opt1.length);
      } else {
      Option1_cb.addItem(Opt1, Opt1);
      if (Opt1 == _level0.cart[ArrLoc].O1) {
      indexVal = indexCnt;
      matchVal = 1;
      comp = true;
      } while (comp == false);
      if (matchVal == 1) {
      Option1_cb.selectedIndex = indexVal;
      } else {
      Option1_cb._visible = false;

      I have placed this code in the cart movie with the correct identification to get to the combo box:


      this is where the other values get loaded. The ComboBox does not respond., even to the _visible = false statement. or any other code.

      I have placed this code in a function in the Entry movie ( the code above come from here)

      When called from the Cart movie the function never executes

      I've placed trace(this._taget) in the entry movie and verified that the path I am using to call the function is the same as the actual location...(the path works to set the other values) .

      Still no success.

      PLEASE HELP ME. I have been working on this one functio for a week. Any sugggestions at this point are worth trying.