A Flash Developer Resource Site

Results 1 to 17 of 17

Thread: [RESOLVED] forgotalot

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    20

    resolved [RESOLVED] forgotalot

    I want users to be able to send an email to an address they supply. In a text entry field (variable=email) they submit an address. But when they click on the button to send the email, an email addressed to email opens.

    I used
    on (release) {
    getURL("mailto:email");

    }

    Where did I go wrong?

  2. #2
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    Code:
    on (release) {
      getURL("mailto:"+email.text);
    }
    AS3 is cooler:
    Code:
    var request:URLRequest = new URLRequest("mailto:name@hotmail.com"+"?subject=Subject"+"&body= Hello world ");   
    navigateToURL(request, "_blank");    
    request.method = URLRequestMethod.POST;
    Last edited by rynoe; 06-07-2012 at 03:36 PM. Reason: monkey stole my sock
    [SIGPIC][/SIGPIC]

  3. #3
    Junior Member
    Join Date
    Jun 2012
    Posts
    20

    new probem

    when i use the code you suggested, I get an email addressed to undefined

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Because you've given your textfield a Variable name, and rynoe assumed you had given it an Instance name, just remove .text from the AS2 code:

    Actionscript Code:
    on (release) {
        getURL("mailto:"+email);
    }
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  5. #5
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    I was hoping to convert our new friend to as3
    [SIGPIC][/SIGPIC]

  6. #6
    Junior Member
    Join Date
    Jun 2012
    Posts
    20
    I actually started out with the code

    on (release) {
    getURL("mailto:"+email);
    }

    however, this produces the error "command line arguments are not valid. verify switches"

    Research seems to indicate that is an Outlook problem. I was wondering if something was wrong with my syntax. That's why I started tinkering with the placement of the quotation marks (obviously not a brilliant move).

    If this is an Outlook problem, will all my audience members (the majority of whom are also running Office 2007 on Windows 7) also experience this? Or is my system "special"?

    Is this something that can be addressed though AS code? (and BTW, AS3 hurts my head)

  7. #7
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Would you mind posting your FLA file?

    I was hoping to convert our new friend to as3
    |
    V
    AS3 hurts my head
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  8. #8
    Junior Member
    Join Date
    Jun 2012
    Posts
    20
    Duh, how do I post my fla? It has other problems, too, but I wanted to address the email issue first, as that's fundamental.

  9. #9
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    Zip up the fla. Reply to thread, scroll down a bit to the 'Manage Attachments' button and click it. From there you attach a document like most other types of apps.
    [SIGPIC][/SIGPIC]

  10. #10
    Member
    Join Date
    May 2012
    Posts
    51
    Quote Originally Posted by simplequestions View Post
    however, this produces the error "command line arguments are not valid. verify switches"
    That's coming from Outlook. When the mailto: protocol is invoked, Windows looks at the registry entry HKEY_CLASSES_ROOT\mailto\shell\open\command for the command-line. On my computer it is
    "C:\PROGRA~1\MICROS~3\Office12\OUTLOOK.EXE" -c IPM.Note /m "%1"
    The %1 is where the text after the mailto: goes. If you plug in a regular e-mail address in the format of user@host.com, it works fine. Things start to get screwy when you try put in double quotation marks. Usually this happens when people want to populate the subject field:

    mailto:user@host.com?subject=Comments about "The Play"
    The " in terminates the command-line argument prematurely, causing the Windows to interpret what follows as additional commands to Outlook. Hence an invalid arguments error.

    The rub is that there is no way to escape the quotation marks. All you can do is remove them. The Windows command-line shell is also not Unicode-aware. Any non-Ascii character will end up as question marks.

    Anyway, in you case, the problem is that the textbox is setting the variable to HTML. Instead of mailto:user@host.com, what you're sending to getUrl() is actually mailto:<p align="left">user@host.com</p>. The quotation marks in the tag in turn is causing Outlook to barf. To fix it, give the textbox an instance name and get the text through _parent.[instance].text or _root.[instance] or something like that, depending on where the text field is.

  11. #11
    Junior Member
    Join Date
    Jun 2012
    Posts
    20
    I was going to send a zipped file, but its only 81 kb
    Attached Files Attached Files

  12. #12
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    Code:
    getURL("mailto:"+MentorsEmail.text);
    Works fine for me after I fixed the other bugs.


    If you use
    Code:
    getURL("mailto:"+MentorsEmail);
    you get level0.MentorsEmail
    Last edited by rynoe; 06-08-2012 at 12:06 PM. Reason: AS2 makes me sad...
    [SIGPIC][/SIGPIC]

  13. #13
    Junior Member
    Join Date
    Jun 2012
    Posts
    20

    Getting Somewhere

    Quote Originally Posted by cleong View Post
    That's coming from Outlook. When the mailto: protocol is invoked, Windows looks at the registry entry HKEY_CLASSES_ROOT\mailto\shell\open\command for the command-line. On my computer it is

    The %1 is where the text after the mailto: goes. If you plug in a regular e-mail address in the format of user@host.com, it works fine. Things start to get screwy when you try put in double quotation marks. Usually this happens when people want to populate the subject field:



    The " in terminates the command-line argument prematurely, causing the Windows to interpret what follows as additional commands to Outlook. Hence an invalid arguments error.

    The rub is that there is no way to escape the quotation marks. All you can do is remove them. The Windows command-line shell is also not Unicode-aware. Any non-Ascii character will end up as question marks.

    Anyway, in you case, the problem is that the textbox is setting the variable to HTML. Instead of mailto:user@host.com, what you're sending to getUrl() is actually mailto:<p align="left">user@host.com</p>. The quotation marks in the tag in turn is causing Outlook to barf. To fix it, give the textbox an instance name and get the text through _parent.[instance].text or _root.[instance] or something like that, depending on where the text field is.
    Thank you thank you thank you--i saw that when I checked the variables and wondered if that was posing a problem!
    on (release) {
    getURL("mailto:"+MentorsEmail.text);
    }

    works beautifully

  14. #14
    Junior Member
    Join Date
    Jun 2012
    Posts
    20
    help again! now that that's working, I want the subject and body to be populated, as well. Starting with the subject,
    on (release) {
    getURL("mailto:"+MentorsEmail.text"?subject=:"+you rName.text);
    }
    should work, but it doesn't

  15. #15
    Senior Member x-death's Avatar
    Join Date
    Aug 2009
    Posts
    175
    Quote Originally Posted by simplequestions
    should work, but it doesn't
    its because you forgot to place a "+" before you put the set of quotation marks. this should work:
    Actionscript Code:
    on (release) {
    getURL("mailto:"+MentorsEmail.text+"?subject="+yourName.text);
    }
    you also put a ":" infront of the subject line. thats completely fine. but its kind of wierd to have it as the first character of your subject line. so i removed it.
    Last edited by x-death; 06-10-2012 at 06:46 AM.

  16. #16
    Junior Member
    Join Date
    Jun 2012
    Posts
    20
    New problem: getting "Statement must appear within on handler" for
    on (press){
    gotoAndPlay(2);
    }

  17. #17
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    That error message comes out when you put variables and fuction on a movieclip without an onClipEvent. Just add
    Code:
    onClipEvent(load){
    on (press){
    gotoAndPlay(2);
    } 
    }
    and everything else you want to add to that, be sure to be inside the onClipEvent. Also i think you have to remove the "for" you wrote there


    Hope this helps [simplequestions]
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

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