ActionScript 1/2 :: Embedding Bold+italic Fonts For HtmlText?
Feb 24, 2010
How can I embed my custom font and it's bold variant (and it's faux italic variant, because there is not real italic version) and get the b and i tags working in a htmlText field?I can use the htmlText field with system fonts (with b and i tags working) ... or I can use 1 of the embedded fonts for the whole text.but I can't seem to get flash to understand the bold and italic variants are also embedded.
createTextField("dynamic_txt", 2, 40, 170, 350, 350); dynamic_txt.embedFonts = true; var emphatic:TextFormat = new TextFormat(); emphatic.size = 40; emphatic.color = 0xFFFFFF; emphatic.font = "EurostileT"; dynamic_txt.html = true;[code]...
View 2 Replies
Similar Posts:
Oct 23, 2008
I've been trying everything with this issue so thought I'd put it out there to see if anyone can offer a solution or even advise if this is possible or not.This is the scenario:
I dynamically create a textField. I load an external CSS file into a stylesheet. From an XML file I load HTML content into the textField via .htmlText I have added the font to the library and have made it available for Export for ActionScript The HTML has spans with classes eg:
<span class="boldText">Flash Flash Flash</span>
The CSS states:
.boldtext {
font-family:Anivers;
font-style:italic;
[code]....
The font I'm using does not have any other family members like bold or italic Here is the problem. Leaving embedFonts = false things work just fine. But obviously I need to embed this font so all can see it. As soon as i set embedFonts = true I no longer get bold or italic.Is this a case of because the font does not have a bold or italic the system it just rendering, or am I just missing something? For example the checkboxes in the font's properties where you can choose bold and italic. I tried these but no luck.
View 13 Replies
May 24, 2006
I have a dynamic text field with the text "IMAGES". The font is Arial, it has BOLD and ITALIC checked, and has basic Latin fonts embedded. Now, I use Actionscript to change the text:
textField.text = "IMAGES";
Suddenly the text disappears! Now, it seems to me that since BOLD and ITALIC are checked on the text field, changing the .text value should simply change the text itself, which should then be rendered in bold and italic, and since I have bold+italic Latin glyphs embedded, it should display properly. But what's clearly happening is that when I set the text using Actionscript, it is attempting to display the NORMAL font instead, and since it's not embedded, it won't display. I know this because if I create another proxy text field off the screen and embed the NORMAL Arial glyphs, the original text field's text will display just fine - as normal-weight text.
But why is this? Do I have to use a TextFormat object to set the text to Bold and Italic EVERY time I want to dynamicaly change the text? This seems silly. I simply want my text field to be bold and italic every time the text changes, and NO normal text!
View 1 Replies
May 21, 2010
I have an HTML string that uses bold and italic tags which I need to apply to a TextField. I need the font to be embedded though and I can't seem to find a way to do this. From what I've read it seems that Flash needs to use the actual bold/italic versions of the font rather than just changing it with HTML? In which case I can't do it all in one textfield because you can't change font? The only solution I found was a suggestion to use the [Embed()] method rather than the method I am using (embedding the font in a library symbol) but I don't think you can do that either with Flash CS3?
View 5 Replies
Jul 18, 2009
I've imported four fonts into the Library and used Linkage to enable Export for Actionscript. The fonts are the four versions of Trebuchet MS:
Trebuchet MS
Trebuchet MS Bold
Trebuchet MS Bold Italic
Trebuchet MS Italic
They are named like this in the Library and for example the 'Bold Italic' version has both 'bold' and 'italic' selected in its properties.
Then I drew a dynamic textfield and selected for it's font 'Trebuchet MS Bold Italic*' so that the embed font was used. I also embeded the glyphs for 'Basic Latin' and 'Latin 1'.
Then I used this code to fill it with text:
ActionScript Code:
my_txt.embedFonts = true;
my_txt.text = "This is a sample";
The text is placed, however, it is always in the Trebuchet MS regular font. Also when I click the bold and italic icons in the Property Bar, the font won't go bold/italic. The same for just bold and just italic. It only turns bold/italic when I delete all font symbols accept the Bold Italic one.
View 9 Replies
Oct 18, 2010
When Embedding fonts in as3 the text getting bold is there any way to rectify it.
View 2 Replies
May 4, 2011
I have a dynamic text box for 3 lines of text. I styled part of the text to be bold and part of it to be regular. When i click on the button to display the text it looks right the first time but if i click on it a second time then all of the text shows up bold instead of just the few lines i assigned the bold tag to.
View 18 Replies
Sep 10, 2009
I can access the read only text property of a StaticText instance (added at design time) by using "for(i=0; i <this.numChildren; i++) .... etc".I can use this text, I can trace it, etc, and I know that you can't write to it (ie its read only). BUT can I some how test that text to see if it is bold/italic/regular?[code]The charCode is the same bold or not, sort of obvious after I think about it.
View 2 Replies
Apr 15, 2005
i made my flash design loading text from a txt file. But the problem is that i can't control the bold and italic from the text.So what i need is kinda content management. The company where i make the design for want to have control of the contant. I already did a quick search about loading html in flash but i wasn't lucky to find anything usefull.
View 2 Replies
Nov 15, 2010
How to embed font so it would have both styles - bold and italic.
When creating new font from drop down menu there are only either bold or italic or other style, but how to embed font with all styles?
View 0 Replies
Oct 13, 2009
I am putting the finishing touches on an as3 project (developped in flex for code and flash cs4 to create the UI) and I am running into a mysterious font issue.
1) I am loading in a swf file with the font outlines (empty dynamic textfields with embedded characters on the stage. One text field for each regular / bold / italic / bold italic font styles).
2) I then load the swf and then in order to make sure that all font faces are properly available I list them in the output window with the following function:
[Code]....
View 3 Replies
Feb 7, 2009
i have a problem with the flash textFormat. I want to write an editor, which only outputs bold (<b>) and italic (<i>) tags and not the other information flash adds to an htmlText.
for example in this case the output trace (myTextField.htmlText) should be exactly the input.
ActionScript Code:
import flash.text.TextFormat;
myTextField.htmlText = "huhuh <b>asjdja</b> asdasd";
trace (myTextField.htmlText);
is there a cleaner solution than replace the other information (font-size etc)
View 0 Replies
Jul 12, 2006
I'm loading an xml file into flash. I have formatted certain parts of the xml file with various html tags, however I run into problems with the <b>bold</b> and <i>italic</i> tags. Even though I have <a href> and <ul> tags working fine?
I have set my text field to html while also using the "myTextfield.htmlText = " as well as using the CDATA tag in the xml file. I also checked the macromedia livedocs, and it says that these tags are standard and are handled by the flash player...
View 14 Replies
Jan 27, 2012
I am using XML file to pass text into a SWF. How can I use styles, either inline or external, to make certain text in the middle of a sentence appear italic or colored or bold, etc. A character or somethinng that you can put right in the XML file.
Code:
<mainText>You have the email message with two domain names: character here hackistan.edu character here and >kevinsgym-uoh.co<. Below is a list of resources to discover more information. Match the web site with the type of information you would expect to find.</mainText>
View 1 Replies
Feb 2, 2012
I am using swf embed font[normal] in my flex application but if i apply bold or italic for the text,its looking normal only. let me know if you have any solution.
View 1 Replies
Jun 24, 2011
Wonder if anyone has run into a situation in which Flash fails to recognize an embedded font with a title like "Gotham rounded" and a style of "italics?" I can't seem to embed the style because of the double name of the font.
View 1 Replies
Feb 4, 2012
I have a client that I build a business card "builder" application for in Flex. All the text elements that users add to the stage are Flex spark TextArea. I have a list of fonts that we allow the user to set on the text areas and some of the fonts included do have Bold and Italic versions of the font. The others that do not I simply disable these options in the control panel so the user doesn't have the option to click bold or italic buttons.
Photoshop does something similar if you load a font that doesn't have Bold or Italic options they disable the dropdown that would allow you to select these options in the text pallet http://grab.by/bOTC
When bold and italic aren't an included font face then Photoshop as a couple of buttons for applying Faux Bold and Italic to the font. Basically they programmatically thicken up the font face or slat it to make it look italic.
I've tried just setting fontWeight and fontStyle on the fonts that don't have bold or italic included in the embedded fonts and the result usually is a "web safe" font shows instead of the selected font or nothing at all happens.
I am wondering if there is a programmatic way that anyone has found that will do this in Flash / Flex. Basically thicken the font face or tilt it slightly to look italic. My guess is this would be pretty difficult and not worth the time and effort to the client but would be a neat thing to figure out and have a solution for.
View 2 Replies
May 28, 2010
It seems like I found a bug in Flash Professional CS5. For some reason a bold capital "U" will not render in htmlText. It will render fine in a normal text box and will render as a lowercase u or as a non-bold capital U. I have tried typing two UUs in a row, typing a letter before the U, but it always skips the bold capital U.
View 8 Replies
May 11, 2010
So I have a MovieClip asset with a dynamic textfield sitting inside of it. I export my .fla as a .swc to use within Flash Builder 4, and create instances of the asset with code, populating the text dynamically from XML.
My issue is that even though I have htmlText enabled, bold and italics tags don't appear to be working. I have a feeling it is because when I created the asset in Flash CS4, the text field makes you specify the font, and the subset of that to use (Regular, Bold, Oblique, etc).
Is there any way to get the htmlText to render bold and italics tags properly without having to completely rethink the way I'm creating all these fields?
View 3 Replies
Nov 4, 2010
I have a shared fonts.swf file containing a variety of fonts that my main swf uses. I have a movieclip within the fonts.swf file which is exported for runtime sharing. In my main swf i have the fonts.swf imported for runtime via a movieclip. This all works fine and allows me to use the fonts within the fonts.swf file in my main swf. All of my text fields are dynamic and created/updated via AS. I use the following method to style my text boxes(additional code removed for succinctness, this is just so you can see the overall methodology)[code]...
View 3 Replies
Nov 12, 2009
I have a single dynamic textfield containing NON-HTML text meant to be displayed in a single typeface: Helvetica Neue - 75 Bold. When I author on a Windows installation, the font displays as Helvetica Roman. When I author on the Mac, the font displays correctly as the boldface version.
how to embed multiple weights of a typeface so you can use HTML markup to, say, mix bold, italic and roman text in the same textfield. This is about manually embedding a single font, Helvetica neue 75 Bold into a dynamic textfield using the Flash IDE and it not working on Windows.
View 14 Replies
Dec 4, 2009
Problem: although I'm embedding Helvetica Neue 75 Bold, flash displays Helvetica 55 Roman. note that it's not Helvetica Neue 55 Roman, but Helvetica 55 Roman. So a completely different Font family that I don't even happen to have installed.
I'm assigning text to a dynamic textfield using myField.text = "My text that I added dynamically.". Once this is done, if you examine the myField.htmlText property you will notice that Flash has added a bunch of crap:
<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Helvetica 55 Roman" SIZE="20" COLOR="#000000" LETTERSPACING="0" KERNING="0">My text that I added dynamically.</FONT></P></TEXTFORMAT>
Notice in particular the <FONT FACE...> tag which is what I believe is causing the problem - it's hard-coding the Helvetica 55 Roman font in there. Where the heck is that even coming from? And more to the point, how to get rid of it?Before you suggest a RegExp, I tried that and it doesn't work. I can strip out the <FONT> tag, but when you then re-apply the new string and trace out the .htmlText property again, that <FONT> tag is back!
Code:
var txt = String(txtQuestion.htmlText).replace(/<FONT[^>]+>(.+)</FONT>/, "$1");
txtQuestion.htmlText = txt;
trace(txtQuestion.htmlText);
Also, note that this ONLY occurs for multiline text fields. As soon as you switch to single line, everything is perfect (except that it's not multiline!!)
View 5 Replies
May 7, 2009
I've seen this a few times and I've tried all the "fixes" but I'm still missing something here. I have "[CDATA[" tags and render as HTML turned on. My AS has HTML "true" and childNodes. However I still can't get my text to render fonts in either BOLD or italic. [URL].
View 1 Replies
Nov 18, 2010
I try to do a site for a community against child abuse, I've got external text files and have choosen render as html. I choose Verdana regular font and embed some swedish characters. When I then write something in the text file it works OK, and so with the <i>, <u> and <li> tags but when I write <b> tags nothing happends at all. Then I tryed to embed the bold font and everything went bold, why is it so? How do I make the bold tag work?
View 1 Replies
May 12, 2009
Anybody know the trick to getting both bold and regular text in a dynamic text field? I can do it with system fonts no problem (using htmlText), but the client wants copy to be Futura Medium and Futura Bold. I'm pretty sure this isn't the first time anyone's had to do this.
View 1 Replies
Nov 3, 2009
I have an xml-based mp3 player which loads the track titles into dynamic text fields from an external .xml file and I can't get the text to bold. I have "use device fonts" checked. If I select the text field in Flash and change the color or size those attributes will change in the published version, but... when I click the B button, it won't render the text bold in the published version.Do I have to add additional font formatting in the actual ActionScript? Here's the AS for the player. I only want to bold the track title which (I think) is about half-way down -- track_title.text = track_list[current];[code]
View 5 Replies
Oct 19, 2011
I am having trouble embedding a font as bold using FB4. I am using TextLayout fields and TextLayoutFormat to do this and my code is as follows:
package {
import flash.display.Sprite;
import flash.text.AntiAliasType;
import flash.text.Font;
import flash.text.TextField;
[Code] .....
The font just displays as normal and the 'fontWeight' property is ignored.
View 1 Replies
Sep 15, 2010
Using:
-Adobe Flash IDE (CS3)
-AS3
First off let me say I did try creating an extra text field off of the main stage set to Bold, and it's Verdana so I'm not exactly "selecting" a second font file all together to be embedded. Instead I am just setting the textfield property Bold to ON.
SO FAR I am not sure what I am doing wrong, but it does not want to go Bold. Aside from using Flex, which I know nothing about.
View 1 Replies
Jun 21, 2010
I've done my fair share on searching for this, and I couldn't really find anything about it except CSS related stuff, which is not what I am looking for. I have a text field on the stage with font Arial, and I embed Arial Regular, Arial Bold, and Arial Italic, and set my font to Font1* (Arial Regular). Then I set textfi.htmlText = "<b>HI</b> YO"; Now this worked fine in my old Flash program, but it won't recognize it in the new one.
View 1 Replies
Jun 17, 2009
There is something that i have been trying to figure out for a while which is stumping me.I have a setup where an air app dynamically reads files, and throws the contents to an SWF inside of it. This SWF is a Flash 10 file and contains a textField where the contents are then displayed.
I want to display the text as htmlTest so i can have it formatted. However, without embedding fonts, the htmlText is jagged and unprofessional.
Though it is a pain to figure out, I am able to embed fonts and display regular dynamic textField text, however i have not been able to a) embed fonts and b) display htmlText without the text disappearing.
View 0 Replies