Archive for November, 2007

Converting html entities in AS3

I'm posting this here mainly because I always have to look it up. But maybe this post will help someone down the road.
Converting a string with html entities (such as &) to their respective symbols:
AS:

public function htmlUnescape(str:String):String
{
    return new XMLDocument(str).firstChild.nodeValue;
}

Converting a string so that it has html entities:
AS:

public function htmlEscape(str:String):String
{
    return XML( new [...]

Posted by Ash on November 2nd, 2007

Filed under Actionscript | 22 Comments »