HOW to insert a 'href' link in flash within the actionscript.. (AS2)

Posted on 2009-12-28
Last Modified: 2013-11-11
hello, i have a flash application where i am loading data from mySQL into Flash.

All works good.  I have a text field called 'imageName' and it loads fine.

However, how can i insert a ' ' before the 'imageName' so that it will open a link when clicked on?

Example.. currently it 'imageName' variable loads 'pic1' into flash.
HOW TO MAKE IT SO THAT THE USER CAN CLICK ON 'pic1' and have a '_blank' browser window open to this link:
""  ??

I know that  it would have to be hardcoded in the actionscript.. anybody know how to do it?

below is my working actionscript.
for (var i:Number = 0 ; i < parseInt(this.cant) ; i++){
			this.ref._root.image_mc.imageName.htmlText = "" + this["imageName" + i] + "";
			this.ref._root.image_mc.imageHolder.loadMovie(this["imageName" + i]) + "";

Open in new window

Question by:sam928
    LVL 19

    Accepted Solution

    this.ref._root.image_mc.imageName.htmlText = "<a target='_blank' href='" + this["imageName" + i] + "'>" + this["imageName" + i] + "</a>";

    Author Comment

    @moagrius.. that works GREAT!!

    however, is it possible to take it one step further and put a caption in there that says 'CLICK HERE'  ?

    I will open another question up .. and if you can help again that would be great.  Thank you!
    LVL 19

    Assisted Solution

    this.ref._root.image_mc.imageName.htmlText = "<a target='_blank' href='" + this["imageName" + i] + "'>CLICK HERE</a>";

    Author Comment

    @Moagrius.. WOW YOU ARE A GENIUS. THAT WORKS PERFECT..  wish i cud give you more points.

    Author Closing Comment

    LVL 19

    Expert Comment

    glad you got it working

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
    The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
    The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now