9 Replies Latest reply on Mar 6, 2007 1:32 PM by aniebel

    asfunction not working

    aniebel Level 2
      Does the fact that I'm parsing this XML have anything to do with the fact that the mailto: function does not work?

      This is the function in Flash:
      function fMailTo(email)
      {
      getURL("mailto:" + email);
      }

      This is an attribute from my XML:
      email="<a href='asfunction:fMailTo,anyname@anydomain.com'>anyname@anydomain.com</a>"

      which, after being parsed and when traced appears like this in the output window:
      <a href='asfunction:fMailTo,anyname@anydomain.com'>anyname@anydomain.com</a>

      going into a dynamic text field with the following properties applied:
      phoneList_txt.html = true;
      phoneList_txt.htmlText = sList;

      sList is where all names, email addresses, etc. are
        • 1. Re: asfunction not working
          Level 7
          aniebel,

          > Does the fact that I'm parsing this XML have anything to
          > do with the fact that the mailto: function does not work?

          It shouldn't. Let's see what you've got in your code.

          > This is the function in Flash:
          > function fMailTo(email)
          > {
          > getURL("mailto:" + email);
          > }

          So far, that looks fine. The above assumes that a string is being
          passed into the fMailTo() function as a parameter, and that the parameter is
          an email address.

          > This is an attribute from my XML: ...
          > which, after being parsed and when traced appears like
          > this in the output window:
          > <a href='asfunction:fMailTo,anyname@anydomain.com'> ...

          When this hyperlink is clicked, asfunction, will invoke the fMailTo()
          function and pass it the parameter anyname@anydomain.com -- at least, it
          should. I would add a trace() statement inside the fMailTo() function to
          make sure a) the function is being triggered at all and b) is receiving the
          email address as expected. (The @ symbol might, for example, need to be
          escaped, though I don't think that would be necessary.)

          > going into a dynamic text field with the following properties applied:
          > phoneList_txt.html = true;
          > phoneList_txt.htmlText = sList;

          So far, so good.

          > sList is where all names, email addresses, etc. are

          Is sList is an array? If so, you would need to pull a particular
          element from that array, right? Something like ...

          phoneList_txt.htmlText = sList[0];

          Could that be it?


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: asfunction not working
            aniebel Level 2
            Thanks for responding, David. I traced the fMailTo function and it's not showing as being called. How can I troubleshoot "why" it's not being called?

            sList is a string from aList which is an array. I've taken attributes from an XML file and put them in order with tabs to display a phone list.

            I've acheived this from formatting the text as follows:
            • 3. Re: asfunction not working
              Level 7
              aniebel,

              > Thanks for responding, David. I traced the fMailTo
              > function and it's not showing as being called.

              That was my hunch.

              > How can I troubleshoot "why" it's not being called?

              I'm thinking asfunction simply can't "see" the fMailTo() function from
              where it's positioned.

              The first goal is to make sure fMailTo() gets triggered. From there,
              you'll be able to trace that parameter and see right away if the incoming
              string is formatted as you expect. If the text field that contains
              asfunction is nested inside a movie clip or some other hierarchy, try one of
              these approaches:

              a) precede the function name with a path ...
              <a href='path.to.asfunction:fMailTo, // etc.

              b) write a liaison function in the scope of that text field that can do the
              pathing for you ...
              <a href='asfunction:fLocalMailTo, // etc.

              function fLocalMailTo(param:String):Void {
              path.to.fMailTo(param);
              }


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."


              • 4. Re: asfunction not working
                Lujunq Level 1
                Hi, is this happening everytime you try to use asfunction or just at this case? I always come up with problems while using asfunction when I embed flash content on my html page using the dreamweaver solution to avoid that acitvex problem (the javascript include of the flash content).
                • 5. Re: asfunction not working
                  aniebel Level 2
                  Hmmm... I don't think I understand. If I debug and show variables, the textfield shows as "Target="_level0.phoneList_txt""

                  The function is also on the main timeline. In this case, are they not both in the same scope?
                  • 6. Re: asfunction not working
                    Level 7
                    aniebel,

                    > Hmmm... I don't think I understand. If I debug and show
                    > variables, the textfield shows as "Target="_level0.phoneList_txt"

                    Yeah, if your code is also in _level0 (that is, the main timeline), then
                    that really shouldn't be a problem. This is starting to get interesting.
                    ;)

                    > The function is also on the main timeline. In this case, are
                    > they not both in the same scope?

                    They sure should be -- that scope being the main timeline.

                    Have you be able to duplicate this issue in another FLA? That would be
                    my next step. Create a new FLA, slap down a quick dynamic text field, and
                    feed it a hard-coded anchor tag with an asfunction href. Right below the
                    ActionScript that accomplishes that, write the function referenced by
                    asfunction and trace that function to see if it fires.


                    David Stiller
                    Adobe Community Expert
                    Dev blog, http://www.quip.net/blog/
                    "Luck is the residue of good design."


                    • 7. Re: asfunction not working
                      aniebel Level 2
                      Here's a link to the files used in this issue:
                      Link to zipped files.
                      • 8. Re: asfunction not working
                        aniebel Level 2
                        OOPS! sorry, that was stuffit... not zip. This one's zipped.

                        Files ZIPPED
                        • 9. Re: asfunction not working
                          aniebel Level 2
                          Ok, thanks to David's help, the answer was found by removing the "asfunction" altogether and using a simple "mailto:" in the XML attribute instead. Not sure but maybe it had something to do with how I was splitting and joining elements in the string.