I'm a total begginer in flash and action script, I do have some knowledge in other programming languages.
By trying to help a friend I added a contact form in his company website, that was made by someone else.
his site is full flash with a index frame that loads several pages.
After I built the new contact.swf and tested locally and also hosted by accessing it straight from the browser and embeded I tried to replace it with the old contact.swf that had no contact form.
During the tests, everything was fine but when included in the site the form is not functioning. The form has a few rules that prevent empty fields with a green text warning. when I access it embeded separatelly in a web page it works, when I access it loaded by index.swf it does nothinh even if I press the submit button.
So I assume the problem is in the index.swf action script.
the button that loads the contact page has this code:
on (rollOver) {
gotoAndPlay(2);
}
on (rollOut) {
gotoAndPlay(11);
}
on (release) {
_root.main.secondary.loadMovie("contact.swf");
_root.main.logo.gotoAndPlay("s1");
}
I assume that is either the way the movie is loaded either there is something like a mask in the index movie that blocks the contact form.
If required I can submit also the fla of the index or the contact.
thanks
LE:
I tried to add to my contact.swf _lotroot=true; and i get compilation erros.
the action script for contact.swf is this:
stop();
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
// ----------------------------------------------------------------
var variables:URLVariables = new URLVariables();
// Be sure to change this URL to the PHP parse file on your site server
var varSend:URLRequest = new URLRequest("http://www.mydomain.tld/form.php");
var varLoader:URLLoader = new URLLoader;
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
status_txt.text = "";
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
function ValidateAndSend(event:MouseEvent):void{
//validate form fields
if(!name_txt.length) {
status_txt.text = "Introduceti numele dvs.";
} else if(!companie_txt.length) {
status_txt.text = "Introduceti numele companiei.";
} else if(!telefon_txt.length) {
status_txt.text = "Introduceti numarul de telefon.";
} else if(!email_txt.length) {
status_txt.text = "Introduceti o adresa de email.";
} else if(!validateEmail(email_txt.text)) {
status_txt.text = "Introduceti o adresa de email corecta.";
} else if(!message_txt.length) {
status_txt.text = "Introduceti mesajul.";
} else {
status_txt.text = "Multumim " + name_txt.text + ", mesajul a fost trimis!";
variables.userName = name_txt.text;
variables.userEmail = email_txt.text;
variables.userMsg = message_txt.text;
variables.companie = companie_txt.text;
variables.telefon = telefon_txt.text;
varLoader.load(varSend);
}
}
function validateEmail(str:String):Boolean {
var pattern:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
var result:Object = pattern.exec(str);
if(result == null) {
return false;
}
return true;
}