11 Replies Latest reply on Nov 5, 2007 11:54 PM by kglad

    Email scores

    deafhead
      Hi all... I hope someone can help me!!

      I have created an Xmas invitation which has a small game in it!! Bit of a promotional thing to get people interested. The gimmick behind it is that whoever scores the highest score we will give a prize to in our xmas party!! Kinda fun.

      What I want to do is one of 2 things...

      1. Send a screenshot of the page as an email attachment - I can' t see any way to do this, it would be good, but I have no idea how I could do this ... If anyone knows how to do it can they PLEASE HELP??

      or

      2. Send an email wth the score in the subject line. This I have done, and it works fine on some PC's, however on some other pc's the subject line is blank...

      For the second option all I have used is the following function:

      getURL("mailto:emailaddress@domain.com?subject=High Score: "+_root.score+"&body=GOOD LUCK! To submit your high score, please click Send button from within this email window. We look forward to seeing you at the Christmas Breakfast.","_blank");

      Like I said the email works on lots of PC's, however lots of PC's it will not work.

      I have also encountered issues with LotusNotes, not allowing any emails to be launched from IE (or any other web browser).

      If anyone can help and suggest any other methods to send a score back to an email address without using server technology that would be great!!

      I am about to tear my hair clean from my head!! PLEASE HELP!!

      Regards,

      Duncan
        • 1. Re: Email scores
          kglad Adobe Community Professional & MVP
          1. can be done but it's an advanced project in as2. it's easier in as3, but still not for a beginner.

          2. using a server side script like perl or php would be more reliable. by using getURL() to send email you're relying on user's having a default email program. most do, some don't
          • 2. Re: Email scores
            deafhead Level 1
            Thanks for that...

            would you be able to explain a little bit fut=rther how I might be able to do the first option?? (taking a screenshot)... I am not a novice... i just haven't done anything serverside before....
            • 3. Re: Email scores
              kglad Adobe Community Professional & MVP
              what's the first option? emailing a screenshot in as2? if yes, check klingemann's bitmapexporter:

              http://www.quasimondo.com/archives/000572.php
              • 4. Re: Email scores
                deafhead Level 1
                Thanks for that... I'm looking through that file now... can you suggest any other way to gather someones score for a game??
                • 5. Re: Email scores
                  kglad Adobe Community Professional & MVP
                  you can just email the score. i don't know why you don't just do that.
                  • 6. Re: Email scores
                    deafhead Level 1
                    That was the original plan, however for some reason on different PC's the subject and body fileds won't get populated, the emails work on most PC's , but not on all!!

                    I am trying to use the method LoadVars:

                    quote:

                    var emailResponse:LoadVars = new LoadVars();
                    emailResponse.onLoad = function(success:Boolean) {
                    if (success) {
                    debug_txt.text = this.result;
                    trace("sucess "+sucess);
                    } else {
                    debug_txt.text = "error downloading content"
                    trace("error downloading content "+sucess);
                    }
                    var email:LoadVars = new LoadVars();
                    email.emailFrom = "user@email.com";
                    email.emailTo = "duncan.buchanan@totallearn.com";
                    email.emailSubject = "High score: "+_root.score;
                    email.emailBody = nameText+"'s high score is: "+_root.score;
                    email.sendAndLoad(" http://www.straight2theace.com/xmas/email.cfm",emailResponse,"POST");
                    };


                    I have the cfm file in the right direction, but nothing seems to be working...

                    any suggestions??
                    • 7. Re: Email scores
                      kglad Adobe Community Professional & MVP
                      remove that apostrophe in nameText+"'s high score is: "+_root.score;

                      then retest. if that doesn't work, use a local (from your swf's html to the cfm file) path to your cfm file. if that doesn't work, make sure you have permssions set so everyone can execute your cfm file. if that doens't work, post your cfm file code here using the attach code option.
                      • 8. Re: Email scores
                        deafhead Level 1
                        I got rid of the apostrophe, changed the file to a local path...but I can't seem to get it to even test the sucess variable?

                        I have put traces in, and it doesn't actully register the if statements at all... I thought it may have had something to do with the function being nested within a movieclip, so I have now placed the script on the root within a function named sendEmail();

                        The function is getting called, however the highlighted traces are NOT WORKING:

                        function sendEmail() {
                        var emailResponse:LoadVars = new LoadVars();
                        emailResponse.onLoad = function(success:Boolean) {
                        trace("in the function");
                        if (success) {
                        debug_txt.text = "Working";
                        trace("sucess");
                        } else {
                        debug_txt.text = "error downloading content";
                        trace("error downloading content "+sucess);
                        }
                        var email:LoadVars = new LoadVars();
                        email.emailFrom = "user@email.com";
                        email.emailTo = "duncan.buchanan@totallearn.com";
                        email.emailSubject = "High score: "+_root.score;
                        email.emailBody = nameText+"s high score is: "+_root.score;
                        email.sendAndLoad("cf/email.cfm",emailResponse,"POST");
                        };
                        }



                        It doesn't seem to be getting into the if else statement at all...

                        below is the cfm file..


                        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                        <html xmlns=" http://www.w3.org/1999/xhtml">
                        <head>
                        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                        <title>Email scores</title>
                        </head>

                        <body>
                        <cfif StructKeyExists(Form, "emailTo")>
                        <cfmail to="#Form.emailTo#" from="#Form.emailFrom#" subject="#Form.emailSubject#">#Form.emailBody#</cfmail>
                        &result=true
                        <cfelse>
                        &result=false
                        </cfif>
                        </body>
                        </html>


                        I have no idea about coldFusion or any backend/database/serverside stuff... I am sure I have stuffed something up here... If you have 2 seconds I would love to send you the source files for you to see what I am doing wrong... or if you could suggest a better way for me to track the high scores....
                        • 9. Re: Email scores
                          kglad Adobe Community Professional & MVP
                          that's not a valid cfm file.

                          if you don't know cf either hire someone that does know it or start to learn a little about it.

                          if you want to hire someone, send me an email via my website. if you want to learn a little check the adobe help files. copy sample code that sends an email. don't try to send any of your variables until you have the email working. then start to add your form variables.
                          • 10. Re: Email scores
                            deafhead Level 1
                            yes I am trying to learn about it... however it is kind of hard to learn, without knowing what to study up on????

                            Would you be able to offer some advice of where to start looking and what I need to pick up. if not that is fine. Thank you for your help, I just assumed sending an email would be something pretty simple using flash, but apparently it isn't...

                            I wouild love it if you could point me in the right direction...
                            • 11. Re: Email scores
                              kglad Adobe Community Professional & MVP
                              here's an example of a cf file i used in a project to send html formatted email: