PDA

View Full Version : Some html tags are rendered, others aren't


semtex
12-14-2005, 05:32 PM
Do you guys have any idea?
I have a flash file that loads xml data in a textfield.
The xml data contains html tags that need to be rendered in flash.

It works fine, except for some crucial tags like <b> and <i>.
I've tried <strong> instead of <b>, but it doesn't work either.

Any Idea what's wrong?

Here's a preview of the html text I try to load:
<strong>Dutch</strong> text.<br /><br />Hier komt wat tekst met <a href="http://www.google.be" target="_blank" title="google link">een link</a>. Iets <i>italic</i> en iets <b>vet</b>.<br />

And here's the actionscript i use:

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild.childNodes[1];
var titel:String;
var tekst:String;
titel = xmlNode.childNodes[0].firstChild.nodeValue;
main.myTextField.htmlText = xmlNode.childNodes[1].firstChild.nodeValue;
bottom = main._y+mask_mc._height-main._height-space;
checkForHeight();
} else {
var tekst:String = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("content/"+_global.CONTENT+".xml.php");

saumya
12-15-2005, 05:37 AM
please use the code tag to render your post with colocoding of your code.

AS far as your problem goes,Not all the html tags are supported in flash player.

Scottae
12-15-2005, 12:17 PM
About supported html tags (http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001459.html)
Supported CSS properties (http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001445.html)

semtex
12-28-2005, 11:37 AM
Sorry.


As far as I can read, <b> and <i> tags are supported in Flash.
Then why is every word between <b> or <i> tags ignored?
I'm using an embedded Verdana font.

[PAUL FERRIE]
12-28-2005, 11:55 AM
I think what you need to do is create a dynamic textfile in your root timeline. in this textfield add some text and make it bold/italic and make sure it is with the font you plan to use.

Thats what i had to do.

semtex
12-28-2005, 12:09 PM
Thanks a lot. That did the trick. I had been searching to resolve this problem for weeks. Looks like it's a Flash bug?

[PAUL FERRIE]
12-28-2005, 12:16 PM
Yeh an old one at that. i had that problem 2 maybe 3 years ago

Scottae
12-28-2005, 04:24 PM
Thanks a lot. That did the trick. I had been searching to resolve this problem for weeks. Looks like it's a Flash bug?

It is not a Flash bug. You have to have a font symbol embedded for each weight (bold) and and style (italic) of the font in order to use the style tags with the embedded font. So for example, you need to have 3 separate font symbols:


DynamicFont (just Verdana font)
DynamicFontBold (Verdana font with bold check box checked)
DynamicFontItalic (Verdana font with italic check box checked)


These all need to be exported for AS in the 1st frame. Then copy and paste this code into first frame of main timeline of the movie with these font symbols:

// Create text field
this.createTextField ("my_txt", 0, 10, 10, 200, 150);
my_txt.border = true;
my_txt.embedFonts = true;
my_txt.html = true;
my_txt.multiline = true;
my_txt.wordWrap = true;

// Create style sheet
var CSS:TextField.StyleSheet = new TextField.StyleSheet ();
CSS.setStyle (".body", {fontFamily:"DynamicFont"});
CSS.setStyle (".bold", {fontFamily:"DynamicFontBold"});
CSS.setStyle (".italic", {fontFamily:"DynamicFontItalic"});

// Set style sheet
my_txt.styleSheet = CSS;

// Set text
my_txt.htmlText = "<span class='body'>";
my_txt.htmlText += "Here is some text. ";
my_txt.htmlText += "Here is <span class='bold'>bold text</span>. ";
my_txt.htmlText += "Here is <span class='italic'>italic text</span>.";
my_txt.htmlText += "</span>";

You should that it works, but you have a huge file size added to your swf due to the embedded fonts.