Skip to main content
September 25, 2006
Answered

Form does not work when it´s laying in a movieclip

  • September 25, 2006
  • 2 replies
  • 230 views

I have isolated the problem and it´s seems to be concentrated to the path “mcForm.skickat eq "yes" below: (the serverside script is done in Php)

I t seems like the form not works when it´s laying in a movieclip called mcForm with a send button simply called “send”
I must place the form in a movieclip, because the form is doing a nice tweening made by Laco tweening method.

Everything works fine if [bold]I don’t place[/bold] the form in a movieclip.

Here´s a part of the actionscript in the main timeline navigation.swf:

if (mcForm.skickat eq "yes") {
gotoAndStop("labelFinished");
}

Here´s the actionscript on the “send” button in mcForm in navigation.swf:
on (release) {
loadVariables(" http://www.homesit.se/phpmail.php", "", "GET");
_parent.play();//This statement is not the problem.
}

The timeline in navigations.swf does never reach the label “finished”

This works fine if I don’t place the form in a movieclip in timeline navigation.swf:

if (mcForm.skickat eq "yes") { //this path is the problem
gotoAndStop("labelFinished");
}

Here´s serverscript in php:
(I have no problem here)

<?
$headline = "Mail from your Homesite";
$text = "$name has sent you mail from your homesite
He/she wrote this:

$message
";
mail($mymail, $headline, $text,
"From:".$email."\nReply-To:".$email);
echo("send=yes");
?>

What could possible be wrong

I appreciate every answer.


    This topic has been closed for replies.
    Correct answer
    The root of the problem (from looking at the code you posted) is that there is no event that determines what should happen when your data comes back from PHP. When using loadvariables, you'd need an onData event for mcForm, like:

    mcForm.onData=function(){
    // do something
    }

    The next problem I see is that the code on your main timeline is checking for the value of mcForm.skickat, but you don't seem to be defining that variable anywhere. The php script returns a variable named "send", but I don't see skickat anywhere. If it's not defined, it's value will always be "undefined".

    To make things more efficient, you really should be using loadVars and a reponsed handler instead of loadVariables. When you use loadVariables, all of the variables in the movie clip are being sent to your php script, which really just a waste of data transfer. By using loadVars, you'll specify which vars to send, making the whole process more efficient. See the docs... it's all in there (with examples).

    BTW... this is the Flash Media Server forum. In the future, you might want to post questions like this one in the general flash or actionscript forum, as you'll get more responses (more people read in on those forums)

    2 replies

    November 3, 2006
    LoadVars,ok
    Sorry for posting in the wrong forrum
    :-)
    Correct answer
    September 25, 2006
    The root of the problem (from looking at the code you posted) is that there is no event that determines what should happen when your data comes back from PHP. When using loadvariables, you'd need an onData event for mcForm, like:

    mcForm.onData=function(){
    // do something
    }

    The next problem I see is that the code on your main timeline is checking for the value of mcForm.skickat, but you don't seem to be defining that variable anywhere. The php script returns a variable named "send", but I don't see skickat anywhere. If it's not defined, it's value will always be "undefined".

    To make things more efficient, you really should be using loadVars and a reponsed handler instead of loadVariables. When you use loadVariables, all of the variables in the movie clip are being sent to your php script, which really just a waste of data transfer. By using loadVars, you'll specify which vars to send, making the whole process more efficient. See the docs... it's all in there (with examples).

    BTW... this is the Flash Media Server forum. In the future, you might want to post questions like this one in the general flash or actionscript forum, as you'll get more responses (more people read in on those forums)