A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: asfunction doesn't work with textarea component?

  1. #1
    Space Monkey daarboven's Avatar
    Join Date
    Sep 2001
    Location
    in the basement boiling soap...
    Posts
    217

    asfunction doesn't work with textarea component?

    hi,
    in my current project i make extensive use of the mx pro textarea component, but today i found out it seems to not support
    PHP Code:
    asfunction 
    like the standard dynamic textfield does.
    if i use:
    PHP Code:
    textarea.text="<a href=\"asfunction:myfunction,foo\">testlink</a>" 
    the text "testlink" shows up, with the handcursor like other hrefs(which work perfectly) but doesn't trigger the function.

    also if i try
    PHP Code:
    textarea.htmlText="<a href=\"asfunction:myfunction,foo\">testlink</a>" 
    the text doesn't show up at all. html is set true for the textarea.

    any ideas on that?

    regards

    daarboven
    :::i am jacks complete lack of surprise:::

  2. #2
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    It's probably a pathproblem. asfunction looks for the function on the same timeline as the textfield it is in. Regarding the textarea component that is the textarea component movieclip.

    There are three ways to solve this:

    1. Make myFunction a global function:
    Code:
    _global.myfunction = function(txt)
    {
        trace(txt);
    }
    2. Add _parent. to the functionname in the asfunction "adress":
    Code:
    textarea.text="<a href=\"asfunction:_parent.myfunction,foo\">testlink</a>"
    3. Put mufunction on the component itself:
    Code:
    textarea.myfunction = function(txt)
    {
        trace(txt);
    }
    /Mirandir

  3. #3
    Space Monkey daarboven's Avatar
    Join Date
    Sep 2001
    Location
    in the basement boiling soap...
    Posts
    217
    _parent did the trick. thanks a load!
    :::i am jacks complete lack of surprise:::

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center