SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    make text act as a button

    I've got a multiline text field within a box, there is too much text to fit within the box so I am using the scrollbar from the components library to allow user scrolling.

    I want to add different mouse event listeners to various parts of the text. I could not work out how to make text act as a button, so I created transparent buttons and placed them ontop of the text (so that they became hit areas). However, when scrolling down on the text field the buttons do not move with the text.

    Is there a way I can make the text act as a button? Or get the transparent buttons I created to scroll with the text?

    Thanks!.

  2. #2
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure there is an easy way to do it.

    You can make text link to a URL by highlighting the text and then entering the URL in the link input field in the properties inspector, but not a way to assign actual effects to it. (Though I'm a few versions and one language behind so this may be newly added functionality that I am unaware of.)

    There may be a way to do it if you convert the text from a dynamic scrolling text field to a scrolling movieclip as then the buttons should scroll with the text.

  3. #3
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,559
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    In as2 you can use asfunction, in as3 you need to use an event e.g

    Code:
    var link_tf:TextField = new TextField();
    link_tf.htmlText = '<a href="event:click here">Click here</a>';
    addChild(link_tf);
    link_tf.addEventListener(TextEvent.LINK, link_event);
    function link_event(event:TextEvent):void
    {
    	trace(event.text); // Link Clicked
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •