0 Replies Latest reply on Sep 23, 2010 2:35 AM by smon_ed

    RichTextEditor text link events - adding parameters to a linked function

    smon_ed Level 1

      In as2 I used asfunction in links to call functions from rich text.

       

      This has now changed and I see there is a new method of calling functions in a RichTextEditor component

       

      I'm importing HTML from a database and placing it into RichTextEditor:

       

      instance.textFlow = TextConverter.importToFlow(txtString, TextConverter.TEXT_FIELD_HTML_FORMAT);
      instance.textFlow.addEventListener("playAudio", audioLinkHandler);
      

       

      And here is my HTML text:

      <P>This is some text and this is an <A HREF="event:playAudio,sound.mp3">audio</A> link.</P>

       

      As you can see, my HTML sets the event as playAudio and there is a parameter (which is a reference to an audio file). This parameter makes the function call fail.

       

      If remove the parameter:

      <P>This is some text and this is an <A HREF="event:playAudio">audio</A> link.</P>

       

      Then the function is called successfully.

       

      I see there is another method of linking to a function, using a click event.  However, I can't see a way of passing a paremeter using that way either.  Note that my parameter will not be the same as my link text, otherwsie I might have been able to use the link text as a parameter.  No can do there.

       

      Can anyone advise me on a way to pass a parameter from my HTML event link to a function?