# \[FMX\] Plz help with HTML in dynamic text field

**URL:** <https://forum.kirupa.com/t/fmx-plz-help-with-html-in-dynamic-text-field/27380>\
**Category:** flash\
**Created:** [August 1, 2003, 6:00pm UTC](https://forum.kirupa.com/t/fmx-plz-help-with-html-in-dynamic-text-field/27380 "2003-08-01T18:00:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![puckett\_jw](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@puckett\_jw](https://forum.kirupa.com/u/puckett_jw)\
**Post date:** [August 1, 2003, 6:00pm UTC](https://forum.kirupa.com/t/fmx-plz-help-with-html-in-dynamic-text-field/27380/1 "2003-08-01T18:00:42Z")

</div>

I have a very simple banner that loads services from a database, which fade up, pause, and fade down at a random spot on stage–repeat with next service. I load them from a asp page the gives:

&Services=Service+1,Service+2,…,Service+N&status=1&

I would like to make the Text a link to the section of my site, so I have modified the asp file to give:

&Services=Service+1,Service+2,…,Service+N&services\_links=link1,link2,…,linkn&status=1&

all of the links are relative URLS and they have been URLEncoded, so all special characters have been escaped.

I have changed my working code from:  
[AS]Services\_mc.Services\_text\_mc.Services\_txt.text = Services\_array[count];

trace("Text Width = "+Services\_mc.Services\_text\_mc.Services\_txt.textWidth);  
trace("Text Height = "+Services\_mc.Services\_text\_mc.Services\_txt.textHeight);

//Move the text feild to a random position on the stage, but make  
//sure that the entire text will fit  
Services\_mc.\_x = Math.random() \* (Scene\_Width - Services\_mc.Services\_text\_mc.Services\_txt.textWidth);  
Services\_mc.\_y = Math.random() \* (Scene\_Height - Services\_mc.Services\_text\_mc.Services\_txt.textHeight);[/AS]  
to:  
[AS]//Build html to go in text field from the two arrays that are built from the database  
//where count is the index of the values that we are on  
Services\_mc.Services\_text\_mc.Services\_txt.autoSize = true;  
Services\_mc.Services\_text\_mc.Services\_txt.html = true;  
Services\_mc.Services\_text\_mc.Services\_txt.htmlText = “\<A HREF=”"+Services\_Links\_array[count]+""\>"+Services\_array[count]+"\</A\>";

trace(“Text Width = “+Services\_mc.Services\_text\_mc.Services\_txt.textWidth);  
trace(“Text Height = “+Services\_mc.Services\_text\_mc.Services\_txt.textHeight);  
trace(“HTML Text = “+”\<A HREF=””+Services\_Links\_array[count]+””\>”+Services\_array[count]+"\</A\>");

//Move the text feild to a random position on the stage, but make  
//sure that the entire text will fit  
Services\_mc.\_x = Math.random() \* (Scene\_Width - Services\_mc.Services\_text\_mc.Services\_txt.textWidth);  
Services\_mc.\_y = Math.random() \* (Scene\_Height - Services\_mc.Services\_text\_mc.Services\_txt.textHeight);[/AS]

Additionally, I have checked the “Render text as HTML” button for the text field., and changed “Embed Font Outlines For” to “No Character” from “All Characters”. However, I have tested it both ways.

When I test the movie, I get nothing on the stage, and this is the output from the trace:

```php
Text Width = 0
Text Height = 28
HTML Text = <A HREF="1">Service 1</A>
Text Width = 0
Text Height = 28
HTML Text = <A HREF="11">Service 11</A>
Text Width = 0
Text Height = 28
HTML Text = <A HREF="111">Service 111</A>
Text Width = 0
Text Height = 28
HTML Text = <A HREF="1111">Service 1111</A>
(Repeat...)

```

And this is a “List Objects” dump:

```php
Level #0:
Variable _level0.$version = "WIN 6,0,21,0"
Variable _level0.Services = "Service 1,Service 11,Service 111,Service 1111"
Variable _level0.services_links = "1,11,111,1111"
Variable _level0.status = "1"
Variable _level0.Services_array = [object #1, class 'Array'] [
    0:"Service 1",
    1:"Service 11",
    2:"Service 111",
    3:"Service 1111"
  ]
Variable _level0.Services_Links_array = [object #2, class 'Array'] [
    0:"1",
    1:"11",
    2:"111",
    3:"1111"
  ]
Variable _level0.Scene_Width = 483
Variable _level0.Scene_Height = 115
Variable _level0.count = 0
Movie Clip: Target="_level0.Services_mc"
Movie Clip: Target="_level0.Services_mc.Services_text_mc"
Variable _level0.Services_mc.Services_text_mc.Services_text = "<P ALIGN=\"LEFT\"></P>"
Edit Text: Target="_level0.Services_mc.Services_text_mc.Services_txt"
    variable = "Services_text",
    text = "\r",
    htmlText = "<P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"25\" COLOR=\"#F4F4F4\"></FONT></P>",
    html = true, textWidth = 0, textHeight = 28, maxChars = null,
    borderColor = 0x000000, backgroundColor = 0xFFFFFF, textColor = 0xF4F4F4, border = false,
    background = false, wordWrap = false, password = false, multiline = false,
    selectable = false, scroll = 1, hscroll = 0, maxscroll = 1,
    maxhscroll = 0, bottomScroll = 1,
    type = "dynamic",
    embedFonts = false, restrict = null, length = 1, tabIndex = undefined,
    autoSize = "left",
    condenseWhite = false

```

I thought that you might not be able to get the text widht and height of htmlText, so I hard codded \_x and \_y to 20, and I still do not see anything on the stage. Could someone please help. If I am doing something stupid, pleaes point it out. I ahve attached my fla and txt file, just incase someone wants to look it over.

Thanks,  
Jimmy Puckett
