Question
calling a function in an imported class - part II
I had asked about this earlier and got it to work. Now the
file that I
had it working for gets loaded into another movie and it does not work
anymore. I can still call the validation function and get the trace, but
it seems like it does not see the variables anymore. How would I modify
it so it does?
Thank you for any help.
The validation function looks like this:
class mainObj {
public function validateForm(tName:String, tCompany:String,
tTitle:String, tAddress:String, tCity:String, tState:String,
tZip:String, tPhone:String, tEmail:String, tEventcity:String,
tEventlocation:String, tEvent:String, tEventstartdate:String,
tEventenddate:String, tLoadindate:String, tStrikedate:String,
cAudio:Boolean, cVideo:Boolean, cLighting:Boolean, cRental:Boolean,
tComments:String):Void {
trace("validate called!");
if (tName == "" || tName == undefined) {
this.showAlertMsg("Please enter your name");
trace("Please enter your name");
} else if (tCompany == "" || tCompany == undefined) {
this.showAlertMsg("Please enter your company's name");
} else if (tPhone == "" || tPhone == undefined) {
this.showAlertMsg("Please enter your telephone number");
} else if (tEmail == "" || tEmail == undefined || tEmail.indexOf("@")
== -1 || tEmail.indexOf(".") == -1) {
trace("Invalid email address: "+tEmail+" infexOf1:
"+tEmail.indexOf("@")+" indexOf2: "+tEmail.indexOf("."));
this.showAlertMsg("Please enter a valid email address");
} else {
var e = new LoadVars();
e.Name = tName;
e.Company = tCompany;
e.Title = tTitle;
e.Address = tAddress;
e.City = tCity
e.State = tState;
e.Zip = tZip;
e.Phone = tPhone;
e.FromEmail = tEmail
e.EventName = tEvent
e.EventLocation = tEventlocation
e.EventCity = tEventcity
e.StartDate = tEventstartdate
e.EndDate = tEventenddate
e.LoadInDate = tLoadindate
e.StrikeDate = tStrikedate
e.Audio = cAudio
e.Video1 = cVideo
e.Lighting = cLighting
e.Rental = cRental
e.Comments = tComments
e.status = "";
e.sendAndLoad("sendContact.php", e, "Post");
this.showAlertMsg("Your message has been sent");
//this.openPage("home");
//_root.menuMC.contactMC.gotoAndPlay("out");
gotoAndPlay("contact");
}
}
public function showAlertMsg(msg:String):Void {
_root.msgBoxMC.msgText = msg;
_root.msgBoxMC.gotoAndPlay("on");
}
}
had it working for gets loaded into another movie and it does not work
anymore. I can still call the validation function and get the trace, but
it seems like it does not see the variables anymore. How would I modify
it so it does?
Thank you for any help.
The validation function looks like this:
class mainObj {
public function validateForm(tName:String, tCompany:String,
tTitle:String, tAddress:String, tCity:String, tState:String,
tZip:String, tPhone:String, tEmail:String, tEventcity:String,
tEventlocation:String, tEvent:String, tEventstartdate:String,
tEventenddate:String, tLoadindate:String, tStrikedate:String,
cAudio:Boolean, cVideo:Boolean, cLighting:Boolean, cRental:Boolean,
tComments:String):Void {
trace("validate called!");
if (tName == "" || tName == undefined) {
this.showAlertMsg("Please enter your name");
trace("Please enter your name");
} else if (tCompany == "" || tCompany == undefined) {
this.showAlertMsg("Please enter your company's name");
} else if (tPhone == "" || tPhone == undefined) {
this.showAlertMsg("Please enter your telephone number");
} else if (tEmail == "" || tEmail == undefined || tEmail.indexOf("@")
== -1 || tEmail.indexOf(".") == -1) {
trace("Invalid email address: "+tEmail+" infexOf1:
"+tEmail.indexOf("@")+" indexOf2: "+tEmail.indexOf("."));
this.showAlertMsg("Please enter a valid email address");
} else {
var e = new LoadVars();
e.Name = tName;
e.Company = tCompany;
e.Title = tTitle;
e.Address = tAddress;
e.City = tCity
e.State = tState;
e.Zip = tZip;
e.Phone = tPhone;
e.FromEmail = tEmail
e.EventName = tEvent
e.EventLocation = tEventlocation
e.EventCity = tEventcity
e.StartDate = tEventstartdate
e.EndDate = tEventenddate
e.LoadInDate = tLoadindate
e.StrikeDate = tStrikedate
e.Audio = cAudio
e.Video1 = cVideo
e.Lighting = cLighting
e.Rental = cRental
e.Comments = tComments
e.status = "";
e.sendAndLoad("sendContact.php", e, "Post");
this.showAlertMsg("Your message has been sent");
//this.openPage("home");
//_root.menuMC.contactMC.gotoAndPlay("out");
gotoAndPlay("contact");
}
}
public function showAlertMsg(msg:String):Void {
_root.msgBoxMC.msgText = msg;
_root.msgBoxMC.gotoAndPlay("on");
}
}