>>..." /> >>..." /> >>..."/>

How do you prepare a string which contains both illegal characters AND hyperlinks for display in MXML in AS3?

222 Views Asked by At

i believe my question is quite simple: I have a string, for example,

" this is a string containing silly characters like " and <<< and >>> and hey look a hyperlink http://www.google.com"

My question is how can I prepare this string to be displayed on an MXML view, using AS3?

any help is greatly appreciated!

1

There are 1 best solutions below

0
On

http://forums.adobe.com/thread/756042

http://cookbooks.adobe.com/post_Hyperlink_Control-13867.html

These link gives you a information about how to create single link without any text like http://www.google.com/May these link will be helpfull to create a link!

But you problem looks different, so first you have to make html string with all of the text and where you want a link at that point you must put a <A> tag with required attribut and where you want a special character you must use its hex code or escape sequence of html like for & = &amp;. my meaing is to say that make a html string without head tag. then give this string to <s:RichEditableText> see example.

  1. First Way.

    <s:RichEditableText> <s:content> <s:p> Here is a link: <s:a href="www.google.com"</s:a> </s:p> </s:content> </s:RichEditableText>

  2. Second way.

//Your Actionscript code.

[Bindable] private var _testString:String= "<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="16" COLOR="#000000" LETTERSPACING="0" KERNING="0">&quot; this is a string containing silly characters like &lt;and &gt; they look a hyperlink <FONT COLOR="#0000FF"><A HREF="http://www.google.com" TARGET="_blank"><B><I><U>http://www.google.com</U></I></B></A></FONT>&quot;</FONT></P></TEXTFORMAT>";

// your mxml content

<mx:RichTextEditor id="richEditableText1"
                       width="100%"
                       htmlText="{testString}"
                       height="100%"/>

Good Luck!