Skip navigation
joshww
Currently Being Moderated

resize combox dropdown

Sep 9, 2012 9:45 AM

hi 

 

how do you resize combox dropdown? i have try from the stage with no luck.  it is inside a movie clip.......

 

 

 

 

 

thanks

Josh

 
Replies
  • kglad
    72,221 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 9, 2012 9:57 AM   in reply to joshww

    show the code you tried and explain the reference to the movieclip parent and the combobox reference.

     
    |
    Mark as:
  • kglad
    72,221 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 9, 2012 2:05 PM   in reply to joshww

    if the code you want to use to control your cb is in the same scope as addComList(), use

     

    com_txt.width, com_txt.height

     

    if the code is in the scope of the parent of form2, use:

     

    form2.com_txt.width, form2.com_txt.height

     
    |
    Mark as:
  • kglad
    72,221 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 10, 2012 6:55 AM   in reply to joshww

    if you want to customize/format the text of the combobox, you can assign one (or more) textformat instances.  for example:

     

    var tfor:TextFormat = new TextFormat();

    tfor.size = 8;

    //if cb is your combobox instance:

     

    cb.textField.setStyle("textFormat", tfor);

    cb.setStyle("disabledTextFormat", tfor);

    cb.dropdown.setRendererStyle("textFormat", tfor);

     

    p.s.  please mark helpful/correct responses.

     
    |
    Mark as:
  • kglad
    72,221 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 10, 2012 10:50 AM   in reply to joshww

    change the font size to suit your needs.  i wasn't suggesting that size=8 was what you should use.

     

    to learn more about styling a combobox (or other flash components): http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3c cc516d4fbf351e63e3d118a9c65b32-7f5b.html

     
    |
    Mark as:
  • kglad
    72,221 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 10, 2012 11:45 AM   in reply to joshww

    then use a different size in the cb's textfield:

     

    var tfor:TextFormat = new TextFormat();

    tfor.size = 8;

    //if cb is your combobox instance:

     

    cb.setStyle("disabledTextFormat", tfor);

    cb.dropdown.setRendererStyle("textFormat", tfor);

    tfor.size=12;
    cb.textField.setStyle("textFormat", tfor);

     
    |
    Mark as:
  • kglad
    72,221 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 10, 2012 1:33 PM   in reply to joshww

    looks like you have to use a different textformat instance for each:

     

     

    import fl.controls.ComboBox;

    import flash.text.TextField;

    import flash.text.TextFieldType;

     

     

    // custom function we create to populate the comboBox list

    // create a new textformat and set the style of it

     

     

    var tfor1:TextFormat = new TextFormat();

     

    com_txt.setStyle("disabledTextFormat", tfor1);

    com_txt.dropdown.setRendererStyle("textFormat", tfor1);

     

    var tfor:TextFormat = new TextFormat();

    tfor.size=11;

     

    com_txt.textField.setStyle("textFormat", tfor);

    com_txt.dropdownWidth = 40;

    com_txt.dropdown.rowHeight = 10;

     

    function addComList ():void {

    com_txt.addItem( { label: "" } );

    com_txt.addItem( { label: "com" } );

    com_txt.addItem( { label: "net" } );

    com_txt.addItem( { label: "org" } );

     
    |
    Mark as:
  • kglad
    72,221 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 11, 2012 7:14 AM   in reply to joshww

    you're welcome.

     
    |
    Mark as:
  • kglad
    72,221 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 11, 2012 8:09 AM   in reply to joshww

    there are a number of ways to learn as3.  some people learn best using a book and some via trial and error.

     

    but i think the most helpful way to learn is to start by learning how to use the adobe help files.  especially, the listing of all classes, properties, methods and events.  learning how to use it (you don't need to learn or memorize it), combined with trial and error (or testing in flash) is what works best for me.

     
    |
    Mark as:
  • kglad
    72,221 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 11, 2012 9:31 AM   in reply to joshww

    you can use its x and y properties to change where it appears on stage:

     

    com_txt.y -= 200;  // will move it up 200 pixels

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points