Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE FLASH: Adobe Flash ForumAdobe Flash TutorialsAdobe Flash Video TutorialsWeb Streaming ForumAdobe Flash

flash form

Cow Forums : Adobe Flash
flash form
by jacob resendez (jacobean) on May 1, 2008 at 1:35:05 pm

I have a flash form. It works properly as long as i leave it as the main swf host in a html page.
but when i load it in to a empty movie in another swf it does not work properly. any help would be greatly appreciated. here is the code :

submit_mc._alpha = 40;
dataSender = new LoadVars();
dataReceiver = new LoadVars();
formCheck = new Object();
formCheck.onKeyUp = function ()
{
if (name_txt.text != "" && email_txt.text != "" && subject_txt.text != "" && message_txt.text != "")
{
alert_txt.text = "";
submit_mc._alpha = 100;
}
else
{
submit_mc._alpha = 40;
} // end else if
};
Key.addListener(formCheck);
normal_border = 8025975;
focus_border = 16420096;
normal_background = 15527142;
focus_background = 15328227;
normal_color = 7826796;
focus_color = 0;
inputs = [name_txt, email_txt, subject_txt, message_txt];
for (var elem in inputs)
{
inputs[elem].border = true;
inputs[elem].borderColor = normal_border;
inputs[elem].background = true;
inputs[elem].backgroundColor = normal_background;
inputs[elem].textColor = normal_color;
} // end of for...in
TextField.prototype.onSetFocus = function ()
{
this.borderColor = focus_border;
this.backgroundColor = focus_background;
this.textColor = focus_color;
};
TextField.prototype.onKillFocus = function ()
{
this.borderColor = normal_border;
this.backgroundColor = normal_background;
this.textColor = normal_color;
};
Selection.setFocus(name_txt);
submit_mc.onRelease = function ()
{
if (name_txt.text != "" && email_txt.text != "" && subject_txt.text != "" && message_txt.text != "")
{
alert_txt.text = "";
_root.play();
dataSender.name = name_txt.text;
dataSender.email = email_txt.text;
dataSender.subject = subject_txt.text;
dataSender.message = message_txt.text;
dataReceiver.onLoad = function ()
{
if (this.response == "invalid")
{
_root.gotoAndStop(1);
alert_txt.text = "Please check email address - does not appear valid.";
}
else
{
_root.gotoAndStop(4);
} // end else if
};
dataSender.sendAndLoad("processEmail.php", dataReceiver, "POST");
}
else
{
alert_txt.text = "Please complete all fields before submitting form.";
} // end else if
};
stop ();




Respond to this post   •   Return to posts index

Re: flash form
by Tony Ross on May 1, 2008 at 2:44:02 pm

Hey Jacob,
Usually when I bring in a outside swf to a movieclip, I change all the "_root" references to "this" instead. So try changing that in your form fla.

Hope this helps, anyone else, please feel free to correct or add in.


Tony



Respond to this post   •   Return to posts index

Re: flash form
by jacob resendez on May 2, 2008 at 7:17:40 pm

So here is my code now. (below)
in the statement...

submit_mc.onRelease = function ()
{
if (name_txt.text != "" && email_txt.text != "" && subject_txt.text != "" && message_txt.text != "")
{
alert_txt.text = "";
play();
dataSender.name = name_txt.text;
dataSender.email = email_txt.text;
dataSender.subject = subject_txt.text;
dataSender.message = message_txt.text;
dataReceiver.onLoad = function ()
{
if (this.response == "invalid")
{
gotoAndStop(1);
alert_txt.text = "Please check email address - does not appear valid.";
}
else
{
gotoAndStop(4);
} // end else if
};

I changed the _root.'s to self's and it still did not work so now i have removed them all together so i am left with just gotandstop's. the form works great as long as it is the main swf. but when i load it into an empty movie it functions as if it is working ( it goes through the motions and displays the "your message has been sent successfully") but the email never shows up.

do i need to add something to

dataSender.sendAndLoad("processEmail.php", dataReceiver, "POST");


here is the full code


submit_mc._alpha = 40;
dataSender = new LoadVars();
dataReceiver = new LoadVars();
formCheck = new Object();
formCheck.onKeyUp = function ()
{
if (name_txt.text != "" && email_txt.text != "" && subject_txt.text != "" && message_txt.text != "")
{
alert_txt.text = "";
submit_mc._alpha = 100;
}
else
{
submit_mc._alpha = 40;
} // end else if
};
Key.addListener(formCheck);
normal_border = 8025975;
focus_border = 16420096;
normal_background = 15527142;
focus_background = 15328227;
normal_color = 7826796;
focus_color = 0;
inputs = [name_txt, email_txt, subject_txt, message_txt];
for (var elem in inputs)
{
inputs[elem].border = true;
inputs[elem].borderColor = normal_border;
inputs[elem].background = true;
inputs[elem].backgroundColor = normal_background;
inputs[elem].textColor = normal_color;
} // end of for...in
TextField.prototype.onSetFocus = function ()
{
this.borderColor = focus_border;
this.backgroundColor = focus_background;
this.textColor = focus_color;
};
TextField.prototype.onKillFocus = function ()
{
this.borderColor = normal_border;
this.backgroundColor = normal_background;
this.textColor = normal_color;
};
Selection.setFocus(name_txt);
submit_mc.onRelease = function ()
{
if (name_txt.text != "" && email_txt.text != "" && subject_txt.text != "" && message_txt.text != "")
{
alert_txt.text = "";
play();
dataSender.name = name_txt.text;
dataSender.email = email_txt.text;
dataSender.subject = subject_txt.text;
dataSender.message = message_txt.text;
dataReceiver.onLoad = function ()
{
if (this.response == "invalid")
{
gotoAndStop(1);
alert_txt.text = "Please check email address - does not appear valid.";
}
else
{
gotoAndStop(4);
} // end else if
};
dataSender.sendAndLoad("processEmail.php", dataReceiver, "POST");
}
else
{
alert_txt.text = "Please complete all fields before submitting form.";
} // end else if
};
stop ();





Respond to this post   •   Return to posts index


Re: flash form
by Jacob Resendez on May 2, 2008 at 5:30:41 pm

So here is my code now. (below)
in the statement...

submit_mc.onRelease = function ()
{
if (name_txt.text != "" && email_txt.text != "" && subject_txt.text != "" && message_txt.text != "")
{
alert_txt.text = "";
play();
dataSender.name = name_txt.text;
dataSender.email = email_txt.text;
dataSender.subject = subject_txt.text;
dataSender.message = message_txt.text;
dataReceiver.onLoad = function ()
{
if (this.response == "invalid")
{
gotoAndStop(1);
alert_txt.text = "Please check email address - does not appear valid.";
}
else
{
gotoAndStop(4);
} // end else if
};

I changed the _root.'s to self's and it still did not work so now i have removed them all together so i am left with just gotandstop's. the form works great as long as it is the main swf. but when i load it into an empty movie it functions as if it is working ( it goes through the motions and displays the "your message has been sent successfully") but the email never shows up.

do i need to add something to

dataSender.sendAndLoad("processEmail.php", dataReceiver, "POST");


here is the full code


submit_mc._alpha = 40;
dataSender = new LoadVars();
dataReceiver = new LoadVars();
formCheck = new Object();
formCheck.onKeyUp = function ()
{
if (name_txt.text != "" && email_txt.text != "" && subject_txt.text != "" && message_txt.text != "")
{
alert_txt.text = "";
submit_mc._alpha = 100;
}
else
{
submit_mc._alpha = 40;
} // end else if
};
Key.addListener(formCheck);
normal_border = 8025975;
focus_border = 16420096;
normal_background = 15527142;
focus_background = 15328227;
normal_color = 7826796;
focus_color = 0;
inputs = [name_txt, email_txt, subject_txt, message_txt];
for (var elem in inputs)
{
inputs[elem].border = true;
inputs[elem].borderColor = normal_border;
inputs[elem].background = true;
inputs[elem].backgroundColor = normal_background;
inputs[elem].textColor = normal_color;
} // end of for...in
TextField.prototype.onSetFocus = function ()
{
this.borderColor = focus_border;
this.backgroundColor = focus_background;
this.textColor = focus_color;
};
TextField.prototype.onKillFocus = function ()
{
this.borderColor = normal_border;
this.backgroundColor = normal_background;
this.textColor = normal_color;
};
Selection.setFocus(name_txt);
submit_mc.onRelease = function ()
{
if (name_txt.text != "" && email_txt.text != "" && subject_txt.text != "" && message_txt.text != "")
{
alert_txt.text = "";
play();
dataSender.name = name_txt.text;
dataSender.email = email_txt.text;
dataSender.subject = subject_txt.text;
dataSender.message = message_txt.text;
dataReceiver.onLoad = function ()
{
if (this.response == "invalid")
{
gotoAndStop(1);
alert_txt.text = "Please check email address - does not appear valid.";
}
else
{
gotoAndStop(4);
} // end else if
};
dataSender.sendAndLoad("processEmail.php", dataReceiver, "POST");
}
else
{
alert_txt.text = "Please complete all fields before submitting form.";
} // end else if
};
stop ();






Respond to this post   •   Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINEDVDsBOOKSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]