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:
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:
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