1 Reply Latest reply on Sep 7, 2007 12:14 PM by Felson_

    yet another but in AS3 combo-box component

    Level 7
      only yesterday i faced one bug with the combo-box component, which i
      mangaged to overcome (with some help from Luke867), and today i have another
      one.

      to remind you - i have a swf containing combo-box which i load into the main
      movie behind a mask. it works fine, except for one minor thing - the
      selected item isn't displayed.
      for testing purposes i made an empty movie, containing a mask and an empty
      MC below it ('con'), into which i load my combo-box-containing swf, which
      not surprisingly doesn't display the selected item, unless i remove the
      mask. of course i've tried embeding the fonts - but guess what, no luck.

      here's my code:

      var ur:URLRequest = new
      URLRequest("C:\\Users\\eRez\\Documents\\AllOfMe\\Timeline019\\swf\\balloon.swf");
      var loader:Loader = new Loader();
      loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
      loader.load(ur);
      con.addChild(loader);

      function loaded(evt){
      evt.target.content.cb.setStyle("embedFonts",true); // the instance name
      of the combo-box is 'cb'
      }

      i've also tried inside the 'loaded' function -
      evt.target.content.cb.getChildAt(1).setStyle("embedFonts",true); // knowing
      that the combo-box' child #1 is the text-input

      no success here either.

      any suggestions?
      thanks,
      eRez
      www.allofme.com

      ps - just to make sure - i've already read this post -
      http://groups.google.com/group/macromedia.flash.actionscript/browse_thread/thread/73b8dd81 3e21984b/8ea80167a48e36d9?lnk=gst&q=combobox+styles&rnum=3&hl=en#8ea80167a48e36d9

        • 1. Re: yet another but in AS3 combo-box component
          Felson_
          I am having the same kind of problem with the ComboBox. I am trying to do something simple.... I want to set the font/size/color of the text it uses.
          You would think that
          MyComboBox.setStyle("textFormat", myFormat);
          Would do the job, but sadly, not.
          While trying to figure out my problem, I may have found the answer to yours.
          Where you have
          -------
          evt.target.content.cb.getChildAt(1).setStyle("embedFonts",true);
          -------
          try this instead.
          ----
          var TmpObj:Object = evt.target.content.cb.getChildAt(1);
          TmpObj.setStyle("embedFonts",true);
          ----
          It seems that if you try and do it in 1 line, it returns type "DisplayObject" which doesn't have a setStyle method.

          Now to my problem....
          Useing the above, I have been able to set the font for the selected text. I still cant find a way to change the font of the list object though. It doesn't show up as one of the children of the ComboBox object. Seems they construct and delete the list on the fly. (Or at least that is the logic I think they are useing.)