A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Need code revision for Flash 6 to 8

Hybrid View

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    5

    Need code revision for Flash 6 to 8

    Please let me know if I should repost in the PHP area... but I'm quite certain this is an actionscript issue.

    I have a VERY simple contact form that seems to work only if publish settings are set to Flash 6, and I need to use Flash 8 for purposes of the rest of the site. I really like the simplicity of this form, or I'd have come up with another solution...

    Can someone just glance at the code and tell me what I need to change so it will work properly set as Flash 8?

    ___________________________________________
    The biggest frustration is that set to Flash 6 (AS2.0), the resulting email doesn't include the data entirely. The resulting email, and the php is posted below the actionscript (scroll down).

    Second frustration, tab index value works properly for the first two fields (name, email) but then skips out of the form on the third tab and highlights an unrelated text object within the scene; not a part of the form. I can't figure out why tabs work for the first two fields properly and not the third ("message") and the fourth, which is the Submit button.

    HOWEVER, the tab indexing does work in the stand alone movie (before bringing the form into this .fla file). In other words, the tab movement in the original .fla, when used as a stand alone file, works.

    Third frustration, if I set to Flash 8, when submit is hit, it returns the first error response, as if there was no name entered into the field. It will not get beyond this point.
    __________________________________________________ _______________
    ACTION SCRIPT for SUBMIT BUTTON

    on (release) {

    if (!Name.length) {
    message = "Please enter your name.";
    }

    else if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
    message = "Please enter a valid email address";
    }

    else if (!Comments.length) {
    message = "Please enter your message";
    }

    else {
    loadVariablesNum ("MailPHP.php", "0", "Post");
    gotoAndPlay(10);
    }
    }

    __________________________________________________ _______________
    PHP MAILER

    <?
    $ToEmail = "myemail@myemail.com";
    $ToName = "Julie";
    $ToSubject = "Contact Form from mywebsite.com";

    $name = $_POST['name'];
    $Email = $_POST['Email'];
    $comments = $_POST['comments'];


    $EmailBody = "Sent By: $name\nVisitor Email: $Email\n\nMessage Sent:\n$comments\n";

    mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, "From: ".$name." <".$Email.">");

    ?>

    __________________________________________________ _______________
    RESULTING EMAIL

    First, the sender is "(unknown sender)

    Then, the body of the message is:
    Sent By: Angie
    Visitor Email:

    Message Sent:
    this is a message test


    The catch is, I entered an email address.... on the front side. It just didn't send the data.
    BUT if I set the publish settings to Flash 8, the form sends the email address... it just doesn't function properly otherwise, as stated above, it gets stuck on the "enter name" response, but will still send when Submit is hit.
    Note: the send to email address in the php code is altered properly in the real file.

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Try this...
    Code:
    loadVariablesNum("MailPHP.php", 0, "POST");
    If that doesn't help, the top three things to check...
    Case-sensitivity of variables and keywords.
    Variables that aren't initialized.
    Dividing by zero.

  3. #3
    Junior Member
    Join Date
    Dec 2009
    Posts
    5
    Thanks so much!

    Ok, here's the update:


    1) Tab issue resolved (accessibility panel, assigned tab index values).
    2) New code fixed the Flash 6 to 8 issue as far as the form functioning at all, however...
    3) Now the email address is collected and sent, but the original two fields that were working no longer do, the name and message.

    Not sure how to determine whether the variables are initializing?
    Also, don't understand dividing by 0 or not... sorry, still learning this stuff.

  4. #4
    Junior Member
    Join Date
    Dec 2009
    Posts
    5

    Thumbs up Resolved: Need code revision from Flash 6 to 8

    Resolved.

    Solution? Remove caps from name and message field. Also added a "z" at the end of each field reference for clarity sake.

    As a side note, thanks for making me learn about Levels.. still not completely understanding the initializing of variables, however. That's next on my agenda to learn.

    Cheers!

    ________________________________________________
    Edited working code:

    on (release) {

    if (!namez.length) {
    message = "Please enter your name.";
    }

    else if (!Emailz.length || Emailz.indexOf("@") == -1 || Emailz.indexOf(".") == -1) {
    message = "Please enter a valid email address";
    }

    else if (!commentsz.length) {
    message = "Please enter your message";
    }

    else {
    loadVariablesNum("MailPHP.php", 0, "POST");
    gotoAndPlay(120);
    }
    }

Tags for this Thread

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