13 Replies Latest reply on Sep 11, 2006 1:44 AM by sambosam

    Mailto (with Subject)

    sambosam
      Hi,

      I am wanting to be able to use the mailto (done that much) and wnat to include the text in the swf for the subject and body.

      eg.. in the swf, there is a text field 'Style 1001', and I wnat to include that in the mailto command so it automatically 'gets?' this text.

      So I need the bit that goes in "subject= ????" . The ???? being the code for getting the 'style 1001'

      Thanks in advance for any help.
        • 1. Re: Mailto (with Subject)
          Level 7
          sambosam,

          > I am wanting to be able to use the mailto (done that much) and
          > wnat to include the text in the swf for the subject and body.

          Okay. Caveat emptor: mailto: mail links are less likely to make it
          through than those using a server side form. (Think about someone who uses
          a public library for Internet access: what default email client does such a
          person have installed? None.)

          > So I need the bit that goes in "subject= ????" . The ???? being
          > the code for getting the 'style 1001'

          In addition to subject=???? you'll also want body=????.

          I may need you to explain in clearer terms what you're after. How are
          you planning to populate both a subject line and body from a single text
          field?


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


          • 2. Re: Mailto (with Subject)
            Level 7
            sambosam wrote:
            > Hi,
            >
            > I am wanting to be able to use the mailto (done that much) and wnat to include
            > the text in the swf for the subject and body.
            >
            > eg.. in the swf, there is a text field 'Style 1001', and I wnat to include
            > that in the mailto command so it automatically 'gets?' this text.
            >
            > So I need the bit that goes in "subject= ????" . The ???? being the code
            > for getting the 'style 1001'
            >
            > Thanks in advance for any help.
            >


            "subject=" + this["Style 1001"].text

            Or even better, take out the space in the instance name:
            "subject=" + Style1001.text

            In either case you'll need to reference the instance from the correct
            scope. If the text field doesn't exist in "this" you'll need to target
            the correct location.

            James O'Reilly
            www.jamesor.com
            • 3. Re: Mailto (with Subject)
              sambosam Level 1
              hi David, thanks for reply..

              For a reference: Sample

              The order button, currently has mialto, and inserts text into subject and body (this is coded). What I want to do is have it 'get' the information that is in the text field (eg ..style etc).



              The infomation in the text is entered manually. If it the script can get this info out, I can standard the workfolow without enditing the mailto script on each product sheet.

              I hope that makes more sense...



              Here is the current script for the Order button..
              • 4. Re: Mailto (with Subject)
                Level 7
                sambosam,

                > What I want to do is have it 'get' the information that is in
                > the text field (eg ..style etc).

                Gotcha. Well, James O'Reilly's reply gives you what you need. In your
                first post, you seemed to indicate (this is where I get a bit lost) that a
                given text field is named "Style 1001" -- I'm not sure if you mean the text
                field's instance name by saying that. Here's the scoop. Most objects in
                Flash, be they text fields, movie clips, buttons, etc., are scriptable
                because they're -- heh, because they're objects. Objects are defined by
                classes. This makes it pretty easy to hit up the documentation for what you
                need.

                You're dealing with a text field, so open the ActionScript 2.0 Language
                Reference and look up "TextField class" -- badda bing, you get your own
                little Owner's Manual for text fields. Characteristics they have are listed
                under Properties; things they can do are listed under Methods; things they
                can react to are listed under Events. Here, you'll want properties ... and
                you'll see that the TextField.text property provides you with whatever text
                exists inside a dynamic or input text field.

                So, like James said, just reference that text field by its instance name
                and invoke the text property. If your text field's instance name is
                Style1001, that would be Style1001.text.

                getURL("mailto:user@domain.com?subject=" + Style1001.text);

                Make sense?

                Instance names aren't the same thing as Library asset names, so make
                sure you're using an instance name in your Property inspector for that
                object.

                It's certainly possible to manipulate the text content of text fields.
                For this, you would consult the String class, which defines all the
                properties, methods, and events of strings (actually, the String class has
                no events, and you'll see that not all classes define all three categories).
                It would likely be easier if you simply use more than one text field to
                contain each separate text content. You'll also want to use the escape()
                function to take care of spaces and other special characters.


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


                • 5. Re: Mailto (with Subject)
                  sambosam Level 1
                  Hello James and David...

                  Thank you voery much for your replies... I think I know what you are suggesting. Will give that a go and report back....

                  cheers...
                  • 6. Mailto (with Subject)
                    sambosam Level 1
                    Hi James and david....

                    It works (kind of :)
                    sample1

                    But... subject not being entered. (Works locally though..... preview etc)... Is that a server side problem?

                    Code is...
                    on (release) {getURL("mailto:user@domain.com? subject="+ style.text);}

                    By the way... cannot seem to nut out how to add data for the body of the message.. ie ?body=size.text.

                    Not sure where to put it within (out) the " mailto:user@domain.com? subject="+ style.text".

                    I think I am probably better of trying to create a form. Not to sure about the coding but will give it a whirl... Is that a better way to go?

                    Cheers again...
                    • 7. Re: Mailto (with Subject)
                      sambosam Level 1
                      Ok... looked at creating a form

                      Sample

                      Two problems so far:
                      1) How do I transfer the data from "Style' (eg Style1001) to the order form when the order button is pressed.
                      2) Will not this setup make an email address open to all (ie.. spammers)

                      Would prefer to use the first option (mailto... with sbject and title) you two originally mentioned. Is there something wrong with my scritp that is not allowing it to transferred online the sameway that it does when run locally?

                      Much appreciated for any guidance....
                      • 8. Re: Mailto (with Subject)
                        Level 7
                        sambosam wrote:
                        > Hi James and david....
                        >
                        > It works (kind of :)
                        > http://www.lumieres.com.au/sample.html
                        >
                        > But... subject not being entered. (Works locally though..... preview
                        > etc)... Is that a server side problem?
                        >
                        > Code is...
                        > on (release) {getURL("mailto:user@domain.com? subject="+ style.text);}
                        >
                        > By the way... cannot seem to nut out how to add data for the body of the
                        > message.. ie ?body=size.text.
                        >
                        > Not sure where to put it within (out) the " mailto:user@domain.com?
                        > subject="+ style.text
                        ".
                        >
                        > I think I am probably better of trying to create a form. Not to sure about
                        > the coding but will give it a whirl... Is that a better way to go?
                        >
                        > Cheers again...
                        >
                        >

                        Actually, I didn't think of this before but you will need to urlencode
                        any text before you add it to the string so something like this would be
                        better:

                        "mailto:user@domain.com?subject=" + escape(style.text) + "&body=" +
                        escape(size.text)

                        James O'Reilly
                        www.jamesor.com
                        • 9. Re: Mailto (with Subject)
                          sambosam Level 1
                          Thanks James..... I really appriciate ur help...

                          Well we are getting closer....
                          Sample-3

                          But subject is wiped... (Not a biggy though as I can work around that.... is the code below correct?

                          cheers again...
                          • 10. Re: Mailto (with Subject)
                            Level 7
                            sambosam wrote:
                            > Thanks James..... I really appriciate ur help...
                            >
                            > Well we are getting closer....
                            > http://www.lumieres.com.au/sample3.html
                            >
                            > But subject is wiped... (Not a biggy though as I can work around that.... is
                            > the code below correct?
                            >
                            > cheers again...
                            >
                            > on (release) {
                            > getURL("mailto:user@domain.com? subject="+ escape(style.text)+ "&body=" +
                            > escape(style.text)
                            > );
                            > }
                            >

                            a) take out the space you have between the ? and the word subject.
                            b) you probably want size.text for the body not style.text.
                            c) maybe output the url to a temporary textfield so that you can see the
                            string when you test online.

                            on (release) {
                            var url:string = "mailto:user@domain.com? subject="+
                            escape(style.text)+ "&body=" + escape(style.text);
                            sometextfield.text = url; // just to see what is being created
                            getURL(url);
                            }

                            James O'Reilly
                            www.jamesor.com
                            • 11. Re: Mailto (with Subject)
                              sambosam Level 1
                              Hi James...

                              This is were I am at:
                              Latest Sample

                              Still polishing up (Preloader etc)...and it will actually sit within another swf I am doing.

                              The code you gave in the last post retruns errors when I check to AS in Flash8. It returns:
                              The class or interface 'string' could not be loaded.
                              var url:string = "mailto:user@domain.com? subject="+
                              Total ActionScript Errors: 1 Reported Errors: 1

                              Any clues?

                              I have set up the ORDER button with in a clip so I only have to edit that and it will change through the entire range (21 in all.

                              If I am sending that data via Mailto, is it possible to 'format' that data that goes into the body? i.e... so that any text data I retrieve via the script can go on various lines - current I seem to only be able to get it to display as on string of text...

                              Once again thanks... Between you and the Derek Franklin book I purchased... things are coming together (slowly:))

                              Simon B
                              www.Lumieres.com.au
                              • 12. Re: Mailto (with Subject)
                                sambosam Level 1
                                Still going on this one....

                                Problem: My text field (Dynamic) is multi-lined, so when it tries to put it in the subject field, it only does the first line. How do I create a substring (?) where by it only uses characters 8-17 (for example).

                                ie: The text field 'style' contains the follow:

                                style:
                                - 3331 -
                                Silk Bias Cut Skirt

                                I want only -3331 - to appear in the subject line.Altenatively, can I get it to remove the returns (next line) in the text..

                                This is my current script:

                                on (release) {
                                getURL("mailto:user@domain.com? subject="+ style.text);
                                }

                                What should I inlcude in the script to either specify what characters OR remove the returns

                                Thanks again in advance...
                                • 13. Mailto (with Subject)
                                  sambosam Level 1
                                  Got it...

                                  mailto:test@test.com?subject=OnlineOrder-Style:"+escape(_level3.style.text.substring(7,15) )+
                                  "&body="+escape(_level3.Intro.text));

                                  Thanks guys