Skip to main content
Inspiring
April 8, 2009
Question

create clickable link

  • April 8, 2009
  • 2 replies
  • 3266 views

I need to create something like this:

   _myButton.addEventListener(MouseEvent.CLICK, onMouseClick);

function onMouseClick(e:MouseEvent):void
{
var request:URLRequest = new URLRequest("http://www.inspired-evolution.com");
navigateToURL(request,"_blank");
}

except not with a button click.

Instead I just need to create the link within text eg:

LinkText.text="Click here to download the doucment";

how can I accomplish this?

This topic has been closed for replies.

2 replies

April 8, 2009

You can do this by setting the text field to html and using the code below.

LinkText.htmlText="<a href='http://www.adobe.com'>Click here to download the doucment</a>";
Inspiring
April 8, 2009

the name of the text field is feedback and I am trying this code, but it doesn't seem to be working.

feedback.setTextFormat(format);
                addChild(feedback);
               
            }else if (type == "success") {
                feedback.text = "Congrats on finishing the exam!\r\nYour score is "+Math.round(score*100)+"%\r\nClick to download your certificate\r\nYou may now close the exam window .";
                feedback.htmlText="<a href='http://www.adobe.com'>Click here to download the document</a>";
                feedback.setTextFormat(format);
                addChild(feedback);

the ouputing result is just Click here to download the document without the hyperlink.

RossRitchey
Inspiring
April 8, 2009

You can't put text AND htmlText into a text field.  It has to be 1 or the other.

So:

feedback.htmlText = "Congrats on finishing the exam!<br>Your score is "+Math.round(score*100)+"%<br>Click to download your certificate<br>You may now close the exam window .<br><a href='http://www.adobe.com'>Click here to download the document</a>";

RossRitchey
Inspiring
April 8, 2009

In flash there is a link input box in the properties panel for text.

1. Select the text you want to be the link.

2. Go to the properties panel.

3. Find the "URL Link" box.  In CS3 this is designated by an icon that looks like a chain link.

4. Enter the URL that you want the text to link to in the box.