A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Embedding fonts to Combo Box

  1. #1
    Senior Member
    Join Date
    Feb 2003
    Posts
    129

    Embedding fonts to Combo Box

    Hello,

    I have a combo box under a mask and I've done some research and discovered that I need to embed the fonts in to it in order for the text to show. I don't want to embed my own fonts, I just want to use the basic default font and get this working, yet I can't seem to find any tutorials that tell you how to do this, they all seem to be about setting the font colour, size and type.

    What's the quickest and easiest method to just get my text visible?

    Thanks!

  2. #2

  3. #3
    Senior Member
    Join Date
    Feb 2003
    Posts
    129
    Thanks for your help. I'm having a problem with it though. My code is:

    Code:
    var isFont:Font = new Font1();
    var isFormat:TextFormat = new TextFormat();
    isFormat.font = isFont.fontName;
    isFormat.size = 12;
    shop_mask.shop_mc.tShirtColour.defaultTextFormat = isFormat;
    shop_mask.shop_mc.tShirtColour.embedFonts = true;
    and I'm getting the error:
    ReferenceError: Error #1056: Cannot create property defaultTextFormat on fl.controls.ComboBox.
    at indoorshredwebsite_fla::MainTimeline/indoorshredwebsite_fla::frame1()

    Any ideas?

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    If tShirtColour is your combobox then try
    tShirtColour.textField
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Senior Member
    Join Date
    Feb 2003
    Posts
    129
    I changed the code to:
    Code:
    var isFont:Font = new Font1();
    var isFormat:TextFormat = new TextFormat();
    isFormat.font = isFont.fontName;
    isFormat.size = 12;
    shop_mask.shop_mc.tShirtColour.textField.defaultTextFormat = isFormat;
    shop_mask.shop_mc.tShirtColour..textField.embedFonts = true;
    and received:

    ReferenceError: Error #1056: Cannot create property defaultTextFormat on fl.controls.TextInput.
    at indoorshredwebsite_fla::MainTimeline/indoorshredwebsite_fla::frame1()

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    That was my mistake. You can do it like this as one way:
    myCombo.textField.setStyle("textFormat",isFormat);
    myCombo.textField.textField.embedFonts = true;
    The first textfield is the textinput and the second is the actual textfield.
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Senior Member
    Join Date
    Feb 2003
    Posts
    129
    Thank you for that, it doesn't return any errors which is good!

    But sadly the combo box doesn't display the text. It shows the text in the drop-down sections, but not in the box next to the little arrow. Masks and combo boxes are difficult partners!

    Any ideas?

  8. #8
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    This does it:
    myCombo.textField.setStyle ("textFormat",isFormat);
    - The right of the People to create Flash movies shall not be infringed. -

  9. #9
    Senior Member
    Join Date
    Feb 2003
    Posts
    129
    Sorry cancerinform, you're really helpful but I'm not following you very well.

    The code I have is:

    Code:
    var isFont:Font = new Font1();
    var isFormat:TextFormat = new TextFormat();
    isFormat.font = isFont.fontName;
    isFormat.size = 12;
    shop_mask.shop_mc.tShirtColour.textField.setStyle("textFormat",isFormat);
    shop_mask.shop_mc.tShirtColour.textField.textField.embedFonts = true;
    Which manages to display the options when i click the drop-down menu on the combo box, however doesn't display them in the combo box's main window when chosen.

    (The comboBox is called tShirtColour in the properties window).

  10. #10
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I tested it and the textfield, which shows up, when the combobox loads (not the drop-down) had the embedded font on my computer.
    - The right of the People to create Flash movies shall not be infringed. -

  11. #11
    Senior Member
    Join Date
    Feb 2003
    Posts
    129
    Well for some reason it's still not working for me. I removed the mask and it works fine, but when the mask is re-applied to the layer, the text just isn't there. I tried to upload an example file which shows my problem but I can't seem to get the .fla under 300kb, which is probably due to the font or component pieces. Instead I've uploaded it elsewhere. If you could take a look I'd appreciate it

    http://www.megaupload.com/?d=93LG3PEY

  12. #12
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    You did not say you have a mask. The mask has to be made with AS.
    - The right of the People to create Flash movies shall not be infringed. -

  13. #13
    Senior Member
    Join Date
    Feb 2003
    Posts
    129
    Yeah I did :P

    Thanks for your help dude! I'll do a bit of googling for using AS3 to mask.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center