Groups | Blog | Home
all groups > flash actionscript > october 2004 >

flash actionscript : htmlText


thoand
10/23/2004 7:16:21 PM
Hi
Does anyone knows why this fails to print the text:
employeeMC._employee.htmlText += "E-mail: <u><a href='" + employeeEmail + "'>"
+ employeeEmail + "</a></u>";

when I hardcode the email it works, eg.:
employeeMC._employee.htmlText += "E-mail: <u><a href='foo@foo.com'>" +
employeeEmail + "</a></u>";

thanks in advance,
T

_jrh_
10/23/2004 7:27:20 PM
thoand
10/23/2004 7:31:55 PM
Hi _jrh_
_jrh_
10/23/2004 7:32:51 PM
thoand
10/23/2004 8:03:26 PM
Hi again

here is the whole code, as you see the text field is allready created in the
movieclip

var employeeLength =
officesXML.firstChild.childNodes[i].childNodes[k].childNodes[6].childNodes.lengt
h;
for (var e = 0; e < employeeLength; e++) {
var employeeName =
officesXML.firstChild.childNodes[i].childNodes[k].childNodes[6].childNodes[e].at
tributes.name;
var employeeTitle =
officesXML.firstChild.childNodes[i].childNodes[k].childNodes[6].childNodes[e].ch
ildNodes[0];
var employeePhone =
officesXML.firstChild.childNodes[i].childNodes[k].childNodes[6].childNodes[e].ch
ildNodes[1];
var employeeMobile =
officesXML.firstChild.childNodes[i].childNodes[k].childNodes[6].childNodes[e].ch
ildNodes[2];
var employeeEmail =
officesXML.firstChild.childNodes[i].childNodes[k].childNodes[6].childNodes[e].ch
ildNodes[3];

var employeeMC = officeAndContactMC.attachMovie("employee", "employee"+e,
e);

employeeMC._x = 0;

if (e == 0) {
employeeMC._y = 232;
}
else {
var prevE = e-1;
var newY =
_root.scroller.scrollerContent.resultHolder0.officeAndContactMC0["employee"+prev
E]._y +
_root.scroller.scrollerContent.resultHolder0.officeAndContactMC0["employee"+prev
E]._height + 5;
employeeMC._y = newY;
}

employeeMC._employee.html = true;
employeeMC._employee.multiline = true;
employeeMC._employee.wordwrap = true;
employeeMC._employee.autoSize = "left";


employeeMC._employee.htmlText = "<b>" + employeeName + "</b> - " +
employeeTitle + "<br><br>";
employeeMC._employee.htmlText += "Telefon: " + employeePhone + "<br>";
employeeMC._employee.htmlText += "Mobil: " + employeeMobile + "<br>";
employeeMC._employee.htmlText += "E-post: <u><a href='" + employeeEmail +
"'>" + employeeEmail + "</a></u>";


}
_jrh_
10/23/2004 8:57:28 PM
What exactly isn't working? It looks okay to me. It should work unless your
fonts are embedded (in the dynamic text box itself) or if the mc that contains
the textbox isn't completely loaded when you're trying to fill the textfield.
thoand
10/23/2004 9:03:05 PM
Hi
The MC is loaded, and I've doubled checked the text box for embedding(in the
script too;))
What I expect to see is eg.:

E-post:: somename@somedomain.com

but when I try to populate the A tag with the employeeEmail variable, the text
above does'nt show
as I said in the first post it works if I just plot in an e-mail adress.

thank you for helping me out

T


_jrh_
10/24/2004 3:58:14 AM
That's strange. The only thing that's wrong in your code is that wordwrap
should be wordWrap, but I'm sure that's not it. Perhaps there's something
blocking the last line from view? Everything else is fine. Hope you figure it
out!
thoand
10/24/2004 7:55:52 PM
Hi

I figure it out

var employeeEmail =
officesXML.firstChild.childNodes.childNodes[k].childNodes[6].childNodes[e].child
Nodes[3];

outputs: <email>foo@foo.com</email>
I guess the <email> messed up the thing a bit, so I needed to get the value by
adding childNodes
which is foo@foo.com

But I find it a bit strange that all the other data prints the values in the
textfields and not the xml tags :)

thanks for taking your time anyway,

regards
T
AddThis Social Bookmark Button