Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I linkify text using ActionScript 3
    primarykey
    data
    text
    <p>I have a text that I want to linkify (identify URLs and convert them to HTML links). The text could be multi-line, and could contain multiple urls like the example below. </p> <p>My current actionscript code looks like this</p> <pre class="lang-java prettyprint-override"><code>&lt;mx:Script&gt; &lt;![CDATA[ import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; private function init():void { var str:String = "@stack the website for google is http://www.google.com and gmail is http://gmail.com"; //Alert.show(linkify(str),"Error"); txtStatus.htmlText = linkify(str); } private function linkify(texty:String):String { //return texty.replace("/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&amp;\?\/.=]+/g",function(m):String { return m.linkify(m);}); //return texty.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&amp;\?\/.=]+/g, function(m):String {return m.linkify(m);}).replace(/(^|[^\w])(@[\d\w\-]+)/g, function(m2):String{return '@&lt;a href="http://twitter.com/' + m2.substr(1) + '"&gt;' + m2.substr(1) + '&lt;/a&gt;'; }); var pattern:RegExp = /[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&amp;\?\/.=]+/g; var match:String = pattern.exec(texty); return texty.replace(pattern,'&lt;a href="' + match + '"&gt;' + match + '&lt;/a&gt;'); } ]]&gt; &lt;/mx:Script&gt; </code></pre> <p>The problem with the above script is that it recognizes the first match and uses that across. Also how do i do it for <code>@</code>?</p> <p>Any help is highly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload