There’s gotta be something I’m missing. It seems as if all I ever do is ask for help. Sorry about that.
Okay. I’m trying to use an alert component to thank a user for sumbitting their information in a form. I don’t get any errors when I hit ctrl+enter, but when I actually press the Submit button in the preview window, I get a message that says
"Submit clicked
Failed to create a new alert, probably because there is no Alert in the Library
"
I have a perfectly good Alert component all stored in my library waiting to be used. Btw, the form works without the alert button. I just thought it’d be nice to give the user some confirmation that his/her information has been submitted.
[edit] Actually, the form doesn’t work anymore, even without the component. I can’t figure out what I’m doing wrong.
Thanks in advance!
Here’s the code I’m using:
import mx.controls.Alert;
thanks = new Object();
thanks.click = function (evt)
{
trace(evt.target.label + " clicked");
Alert.show("Thank you for submitting your informaiton",Alert.OK, _root, alertHandler,Alert.OK);
}
namebox.tabIndex = 1;
emailbox.tabIndex = 2;
submit.onPress = function() {
var myLoadVars = new LoadVars();
myLoadVars.name = name.text;
myLoadVars.email = email.text;
myLoadVars.send("form.php");
submit.addEventListener("click",thanks );
alertHandler = function(theEvent)
{
if (theEvent.detail == Alert.NO)
{
// no button
trace ("Ok? What do you mean, \"ok?\"");
}
}
namebox.text=" "
emailbox.text=" "
}