3 Replies Latest reply on Jan 31, 2007 9:36 PM by Marghoob Suleman

    ComboBox Items List Invisible!!

    Level 7
      I've put on the library a combobox so i can call it at runtime.
      That combo is created inside a movieclip (for effects and so on) and items
      are added at runtime.
      I have the problem that the combo show only the selected item and if i try
      to browse it's content nothing happends...it doesn't open.
      The strange behaviour is that if i click where i suppose to be an item, that
      item become the active item.

      Added a simply portion of code to show that, so you can help me.

      _root.createEmptyMovieClip("mcHolder", _root.getNextHighestDepth());

      with (mcHolder) {
      beginFill(0xFF00FF, 100);
      moveTo(0, 0);
      lineTo(200, 0);
      lineTo(200, 200);
      lineTo(0, 200);
      endFill();
      _x = 100;
      _y = 100;
      }

      mcHolder.createObject("ComboBox", "ccbTest", _root.getNextHighestDepth());

      for (var i:Number = 0; i<10; i++) {
      mcHolder.ccbTest.addItem("val"+i, i);
      }

      Regards


        • 1. ComboBox Items List Invisible!!
          Marghoob Suleman Level 1
          Hi Manfrons...

          you just need to add a line... after craeting combo object... please see attched code...

          mcHolder._lockroot = true;





          • 2. Re: ComboBox Items List Invisible!!
            Level 7
            I read that if you use Components, the getNextHighestDepth() function return
            1048575 instead the first free value of depth.
            Macromedia suggest to doesn't use it but use DepthManager, but i don't know
            it.

            Your hint works!!
            Other way is to use a function to test if at a specific depth there are some
            mcs and use it for create the original mc:

            function findFreeDepth(path:Object):Number {
            var freeDepth:Number;
            var maxAllowedDepth:Number = 1048575;
            for (var a:Number = 0; a<maxAllowedDepth; a++) {
            if (path.getInstanceAtDepth(a) == undefined) {
            freeDepth = a;
            break;
            }
            }
            return freeDepth;
            }

            "Marghoob Sulemaan" <webforumsuser@macromedia.com> ha scritto nel messaggio
            news:eppugu$kdb$1@forums.macromedia.com...
            > Hi Hamfrons...
            >
            > you just need to add a line... after craeting combo object... please see
            > attched code...
            >
            > mcHolder._lockroot = true;
            >
            >
            >
            >
            >
            >
            >
            > _root.createEmptyMovieClip("mcHolder", _root.getNextHighestDepth());
            > with (mcHolder) {
            > beginFill(0xFF00FF, 100);
            > moveTo(0, 0);
            > lineTo(200, 0);
            > lineTo(200, 200);
            > lineTo(0, 200);
            > endFill();
            > _x = 100;
            > _y = 100;
            > }
            > mcHolder.createObject("ComboBox", "ccbTest", _root.getNextHighestDepth());
            >
            > //you need to add this line...
            > mcHolder._lockroot = true;
            >
            >
            > for (var i:Number = 0; i<10; i++) {
            > mcHolder.ccbTest.addItem("val"+i, i);
            > }
            >


            • 3. Re: ComboBox Items List Invisible!!
              Marghoob Suleman Level 1
              Yaa its true that we should use DepthManager as Macromedia reccommends 2... however i've tried with DepthManager... but it works as it was working before... i dont think this is depth problem... i've tried to create a comboBox with the help of DepthManager class... it creates object on depth 20, 40 and so on...

              see the attached code... please commnent the _lockroot and see the difference.