开发者

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.


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

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


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/


Escape should do it:

http://livedocs.adobe.com/flex/201/langref/package.html#escape%28%29

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜