A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: as3 contact form help

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    5

    as3 contact form help

    hello, i am using KM7 and am a complete noob. I'm in the process of creating a website and have run into a problem i need help with.

    I am trying to make a contact page, and i'm not sure i'm going about it in the correct way.

    I tried using a combobox that would jump to different frames in the movie which would contain the different contact forms, but i could only get it to work in flash8, and then when importing a flash9 swf file, the combobox lost all functionality.

    I would like to create a contact form in which the user can select from three different options, bookings, info, and artist submissions. For the first two selections (bookings/info) i only need the following input fields: name, email, subject, message. For the third (artist submissions) i would like the user to have the ability to attach a mp3 file to the email, as well as the previous fields.

    The rest of my movie is using flash 9 so i assume i would need to keep this constant, and cant figure out how to make the contact form functional.

    Any suggestions or help on how i can accomplish this would be greatly appreciated.

    Thank you for you time..

    best wishes,
    cbthen00b

  2. #2
    Junior Member
    Join Date
    Mar 2010
    Posts
    5
    ok, i got the combobox sorted, but i still have no clue how to make the contact forms functional..

  3. #3
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    The "Input forms" section on KoolExchange ( www.koolexchange.com ) has an example Bret created.

  4. #4
    Junior Member
    Join Date
    Mar 2010
    Posts
    5
    thanks, i've got the example downloaded and it is extremely helpful. Im still tryin to figure out how add an attachment to the mail any suggestions?

    Another problem i'm having is with using multiple addresses for the form to send to. my project is a 5 frame movie, frame 1&2 are just the combobox. When an item on the combobox is selected it jumps to a different frame.

    Frame3 - booking info/email sent to bookings@domain.com
    Frame4 - general info/email sent to info@domain.com
    Frame5 - artist submission info/email sent to submissions@domain.com

    all three frames use the same instances of text boxes for the contact form, and i'm trying to figure out how to get the combobox selection to populate a textbox which can be accessed by the php file to determine which email address the mail should go to..

    for example, if the selected item on the combobox is bookings, then the textbox text = bookings.

    and if textbox text = bookings send email to "bookings@domain.com"

    Is this even possible? I assume it would be, but i have been searching the internet for days and cant figure out how to make it work

    my code is:

    combobox1.addEventListener(Event.CHANGE, myChangeHandler);

    function myChangeHandler(e:Event):void {
    gotoAndStop(combobox1.list.selectedItem.value)
    }

    combobox1.addEventListener(Event.CHANGE, myHandler);
    function myHandler(evt:Event):void {
    txt5.text=combobox1.selectedItem.label;
    }



    .................................................. ............
    combobox works but doesnt populate the textbox

  5. #5
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Why do you need multiple frames and a textfield ?
    You should be able to use the combobox label or value directly to send to your php file.

    What might help is to look at the Flash 9 docs on the URLLoader and URLVariables classes.
    http://livedocs.adobe.com/flash/9.0/...URLLoader.html
    http://livedocs.adobe.com/flash/9.0/...Variables.html

    Also Chris Seahorn has an AS3 based contact form example on his KM-Codex site ( http://www.km-codex.com/?page_id=1047 ) you might want to study.

  6. #6
    Junior Member
    Join Date
    Mar 2010
    Posts
    5
    you sir, are a genius! I DO NOT need a textbox. I'm still going to use the seperate frames for each selected item so that I may have a different different pictures and information for each contact form, but i have changed the value of each item in the combobox to the corresponding email address and then just gave the corresponding keyframe the same label. MUCH EASIER!! Thank you!!

    Chris's page has LOTS of useful information and solves other issues I hadn't figured out yet

    I'm still trying to figure out how to attach a file to an email address. Do you know of any examples I could learn from? This is all still greek to me and a bit more complicated than I had anticipated.

    Anywho, thank you again for all your help. Its very much appreciated.

  7. #7
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    As far as I know you can't attach a file directly using ActionScript.
    You will have to use the FileReference class ( http://livedocs.adobe.com/flash/9.0/...Reference.html ) to let the user browse for a file and upload it to the server. The actual attaching to a message and sending the message would need to be done using a php script.

  8. #8
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    I used file attachments quite a bit with Koolmoves forums I've built (to send things like the Terms of Service and Forum Guidelines) and use a mime mail class to attach the file on the backend. There are tons of php mime mail examples found with a Google search I imagine. In your case if you wanted to send a specific file attachment based on what option a user chose in your Koolmoves frontend, I would suggest posting a variable from Koolmoves to php that indicates the option chosen and have your php backend atttach the correct file to your email based on what that variable is.

  9. #9
    Junior Member
    Join Date
    Mar 2010
    Posts
    5


    a;lkdsjf;alkdsjf;lakdsjf;lkadsjf;lkjasd;lfkja;ldsk fj

    ok, i've changed strategies a bit. I've created 3 seperate movies for the 3 seperate contact forms. 2 of them are working fine, but i'm having LOTS of trouble figuring out the 3rd one with file attachment for the email. I've managed to create a button that opens a file browser, but thats about all i can figure out. I dont know how to upload the file to the server and send it as an attachment in my email using php. I've tried TONS of different examples, and they're just not working for me.




    i attached a copy of my project if that helps....
    Last edited by CbTheN00b; 04-08-2010 at 06:17 AM.

  10. #10
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    This is not trivial.
    To upload requires some PHP or other server sided code to accept the upload. Then when you get verification of the uploads success you then must use PHP again to send the attachment. You might want to get help getting the PHP side working first for sending, Then when you have that working you can work on uploading the file, then work on integrating it all into your flash AS3.

    Learn to walk before you run I always say.
    Again 3 steps

    1) learn to send Attachments via PHP
    2) learn to upload from flash to PHP
    3) Learn to integrate the above working ideas into your flash

    Might I suggest you look at http://phpbuilder.com/board/forumdisplay.php?f=10 for help with the PHP side of things

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