making dynamic text clickable

Posted on 2006-03-30
Last Modified: 2010-05-18
I'm loading external data (text) into a TextArea and now I want to make parts of that text clickable. What is the best way to make text in a TextArea trigger an action, specifically a call to setMedia()? Is there a way for HTML anchor tags to trigger events within a Flash file? Or some other approach?

This is for a playlist that goes with a custom video player. The playlist TextArea will be in the same .swf file as the video player component.
Question by:merwetta1
    LVL 39

    Accepted Solution

    Hi, i'm not sure what version of flash you're using, but there's the good ol asFunction that always works a charm for me...

    from help files...

    function MyFunc(arg){ //replace with your setMedia() method
      trace ("You clicked me! Argument was "+arg);
    myTextField.htmlText ="<A HREF=\"asfunction:MyFunc,Foo \">Click Me!</A>";

    how are you loading ur text, using LoadVars? simply swap out the text above into your txt file.
    should do the trick.
    LVL 6

    Author Comment

    asfunction is what I was looking for. thanks.

    I want to display the dynamic data in a TextArea so the scrollbars will be handled for me. However, a TextArea component makes its embedded TextField a child of the current timeline. I figured out that if you want to use the asfunction protocol in a TextArea, you need to add "_parent." to the function name...

    myTextArea.text ='<A HREF="asfunction:_parent.MyFunc,Foo">Click Me!</A>';

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
    Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
    The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

    728 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

    20 Experts available now in Live!

    Get 1:1 Help Now