How to load the contact.swf into the main.swf?

Hi
I just made my first contact form with flash MX. It works very well. But when I load the contact.swf into main movie, something goes wrong because I receive empty e-mails. If I run (only) contact.swf by itself, I’ll get e-mail with content. I’m pretty sure that this is a very simple case but I can’t solve it by myself. I would be very happy if someone helped me.

Thanking in advance

This is the code in the layer1 of contact.swf:

function clrData(){
this.formData.name = “”;
this.nameIn.text = “”;
this.formData.company = “”;
this.companyIn.text = “”;
this.formData.address = “”;
this.addressIn.text = “”;
this.formData.zip = “”;
this.zipIn.text = “”;
this.formData.city = “”;
this.cityIn.text = “”;
this.formData.phone = “”;
this.phoneIn.text = “”;
this.formData.email = “”;
this.emailIn.text = “”;
this.formData.message = “”;
this.messageIn.text = “”;
phone2In.setValue(false);
letterIn.setValue(false);
email2In.setValue(false);
permissionIn.setValue(true);

}

function myOnLoad(success){
errBox.setEnabled(true);
if(success){
errBox.setIcon(“info”);
errBox.setTitle(“Kiitos”);
errBox.setMessage(“Kiitos viestistäsi. Vastaamme sinulle mahdollisimman nopeasti”);
errBox._visible=true;
clrData();
}
else{
errBox.setIcon(“Virhe”);
errBox.setTitle(“Järjestelmävirhe”);
errBox.setMessage(“Valitettavasti lähetyksen aikana havaittiin ongelmia. Ole hyvä täytä ja lähetä lomake uudelleen”);
errBox._visible=true;
}
}
function goPostal(){

errBox.setIcon(“info”);
errBox.setTitle(“Viestiä lähetetään”);
errBox.setMessage(“Viestiä lähetetään”);
errBox._visible=true;
errBox.setEnabled(false);
formData.sendAndLoad(“http://sloop.fi/cgi-bin/mail.cgi”, replyData, “post”);
}

And here’s the code in layer2 (contact.swf):

formData = new LoadVars();
formData.name = “”;
formData.company = “”;
formData.address = “”;
formData.zip = “”;
formData.city = “”;
formData.phone = “”;
formData.email = “”;
formData.message = “”;
formData.phone2 = “”;
formData.letter = “”;
formData.email2 = “”;
formData.permission = “”;
replyData = new LoadVars();
replyData.onLoad = myOnLoad;
globalStyleFormat.FMessageBoxTitleText = new TextFormat( “Arial Bold”, 15, 0xffffff);
globalStyleFormat.applyChanges();
errBox.setButtonWidth(50);

This is the code of contact button in the main movie (main.swf):

on (release) {
loadMovieNum(“contact.swf”, 1);
}

i figure you have a submit button in the contact swf, the loadmovie becomes a level, so in order to target the contact swf, _leveln should be used.(the n being the integer correlating with the depth of the loaded movie), as with _root.movieclip, _leveln.target, so everywhere you have a targeting, like formdata.name, it’s line should be _leveln.formdata.name.

the rationale is this, when you have the contact swf, it is written in the first person, ie, _root is the constant, when contact.swf is brought within another, the dynamics change, the writing then becomes third person as _root. no longer applies, as it is the shell or main swf. so in effect, you collect data and it’s inaccessable, because you didn’t define where it is located. I hope this helps
tumuat

Hi,

Yeah, I finally solved my mystery problem - thanks for your support. I changed the code of contact button into the main movie. Here’s the new code:

on (release) {
_root.currMovie = “yhteystiedot”;
container.loadMovie(_root.currMovie+".swf");
}

I Created a new empty movie clip (name: container (Instance name is also container)) into the main.swf.

This is how the code changed into the contact.swf:

Layer2:

_root.formData = new LoadVars();
_root.formData.name = “”;
_root.formData.company = “”;
_root.formData.address = “”;
_root.formData.zip = “”;
_root.formData.city = “”;
_root.formData.phone = “”;
_root.formData.email = “”;
_root.formData.message = “”;
_root.formData.phone2 = “”;
_root.formData.letter = “”;
_root.formData.email2 = “”;
_root.formData.permission = “”;
replyData = new LoadVars();
replyData.onLoad = myOnLoad;
globalStyleFormat.FMessageBoxTitleText = new TextFormat( “Arial Bold”, 15, 0xffffff);
globalStyleFormat.applyChanges();
errBox.setButtonWidth(50);

The code which located in layer1 didn’t change at all.

I’m very grateful for your support. It is very nice to see this forum really works.

ahhh… i see, nice use of corrective surgery… shoulda seen that, but i am blind when it comes to simplicity…

I’m very grateful for your support. It is very nice to see this forum really works.

yes it does really work, its helped me out of a couple of pickles, and its wonderful to see another happy user :wink: