Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encode HTML in Flex/Actionscript

Are there any functions available to convert:

Me, Myself & I

to

Me, Myself & I

I can't find anything in the Flex documentation.

Thanks.

like image 779
Gabriël Avatar asked Feb 26 '10 14:02

Gabriël


2 Answers

Check this out. No swc's to include. Basically it's

var s:String = new XMLNode(3, "Me, Myself & I").toString();

like image 74
adamcodes Avatar answered Nov 04 '22 13:11

adamcodes


Here's the AS3 solution:

import flash.xml.XMLNode;
import flash.xml.XMLNodeType;

public function htmlEscape(str:String):String {
    return XML( new XMLNode( XMLNodeType.TEXT_NODE, str ) ).toXMLString();
}

Source: http://www.razorberry.com/blog/archives/2007/11/02/converting-html-entities-in-as3/

like image 34
bukzor Avatar answered Nov 04 '22 13:11

bukzor