Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/10/2011, 16:33
Ombu
 
Fecha de Ingreso: octubre-2011
Mensajes: 3
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: Formulario de Contacto en PHP y FLASH

Acciones del boton 'Enviar Email' de contact.fla
Código:
stop ();
caurina.transitions.properties.FilterShortcuts.init();
Stage.scaleMode = "noScale";
Stage.align = "TL";
emailsend = false;
var XMLdaten = new XML();
XMLdaten.ignoreWhite = true;
XMLdaten.load(_global.modulexml);
imageLoader = function (item, link)
{
    item._alpha = 0;
    var _loc2 = new MovieClipLoader();
    var _loc1 = new Object();
    _loc2.addListener(_loc1);
    _loc1.onLoadComplete = function (mc)
    {
        caurina.transitions.Tweener.addTween(item, {_alpha: 100, time: 1, transition: "easeOutSine"});
    };
    _loc2.loadClip(link, item);
};
XMLdaten.onLoad = function (success)
{
    if (success)
    {
        XMLdaten_infotext = XMLdaten.firstChild.childNodes[0];
        XMLdaten_name = XMLdaten.firstChild.childNodes[1];
        XMLdaten_email = XMLdaten.firstChild.childNodes[2];
        XMLdaten_message = XMLdaten.firstChild.childNodes[3];
        XMLdaten_sendmail = XMLdaten.firstChild.childNodes[4];
        XMLdaten_errorname = XMLdaten.firstChild.childNodes[5];
        XMLdaten_erroremail = XMLdaten.firstChild.childNodes[6];
        XMLdaten_errorfield = XMLdaten.firstChild.childNodes[7];
        XMLdaten_finished = XMLdaten.firstChild.childNodes[8];
        XMLdaten_notfinished = XMLdaten.firstChild.childNodes[9];
        imagelink = XMLdaten.firstChild.attributes.imageurl;
        imageLoader(contact.imageholder, imagelink);
        xmlloaded = true;
        cssfile = new TextField.StyleSheet();
        cssfile.load("xml/styles.css");
        cssfile.onLoad = function (success)
        {
            if (success)
            {
                cssloaded = true;
                contact.info_text.styleSheet = cssfile;
                contact.info_text.autoSize = "left";
                contact.info_text.htmlText = XMLdaten_infotext;
                contact.form.name_label.htmlText = XMLdaten_name;
                contact.form.email_label.htmlText = XMLdaten_email;
                contact.form.message_label.htmlText = XMLdaten_message;
                contact.form.sendmail.txt.htmlText = XMLdaten_sendmail;
                contact.form.name_text.text = "";
                contact.form.email_text.text = "";
                contact.form.message_text.text = "";
                sender = function (namevar, emailvar, msgvar)
                {
                    session = "?nocache=" + random(999999);
                    buffer = new LoadVars();
                    buffer.idvar = "email";
                    buffer.nametxt = namevar;
                    buffer.emailtxt = emailvar;
                    buffer.messagetxt = msgvar;
                    contact.text_error.htmlText = XMLdaten_finished;
                    emailsend = true;
                    caurina.transitions.Tweener.addTween(contact.form.sendmail, {_alpha: 60, time: 5.000000E-01, transition: "easeOutExpo"});
                    contact.form.sendmail.useHandCursor = false;
                };
                test = function ()
                {
                    contact.text_error.styleSheet = cssfile;
                    contact.text_error.htmlText = "";
                    testemail = function (eaddy)
                    {
                        if (eaddy.length >= 7)
                        {
                            if (eaddy.indexOf("@") > 0)
                            {
                                if (eaddy.indexOf("@") + 2 < eaddy.lastIndexOf("."))
                                {
                                    if (eaddy.lastIndexOf(".") < eaddy.length - 2)
                                    {
                                        return (true);
                                    } // end if
                                } // end if
                            } // end if
                        } // end if
                        return (false);
                    };
                    namevar = contact.form.name_text.text;
                    emailvar = contact.form.email_text.text;
                    msgvar = contact.form.message_text.text;
                    if (msgvar != "" && emailvar != "" && testemail(emailvar) && namevar != "")
                    {
                        sender(namevar, emailvar, msgvar);
                    } // end if
                    if (msgvar == "")
                    {
                        contact.text_error.htmlText = contact.text_error.htmlText + XMLdaten_errorfield;
                    } // end if
                    if (emailvar == "")
                    {
                        contact.text_error.htmlText = contact.text_error.htmlText + XMLdaten_erroremail;
                    }
                    else if (emailvar != "" && !testemail(emailvar))
                    {
                        contact.text_error.htmlText = contact.text_error.htmlText + XMLdaten_erroremail;
                    } // end else if
                    if (namevar == "")
                    {
                        contact.text_error.htmlText = contact.text_error.htmlText + XMLdaten_errorname;
                    } // end if
                };
                contact.form.name_text.onSetFocus = function ()
                {
                    caurina.transitions.Tweener.addTween(contact.form.bg1, {_alpha: 100, time: 5.000000E-01, transition: "easeOutExpo"});
                };
                contact.form.name_text.onKillFocus = function ()
                {
                    caurina.transitions.Tweener.addTween(contact.form.bg1, {_alpha: 60, time: 5.000000E-01, transition: "easeOutExpo"});
                };
                contact.form.email_text.onSetFocus = function ()
                {
                    caurina.transitions.Tweener.addTween(contact.form.bg2, {_alpha: 100, time: 5.000000E-01, transition: "easeOutExpo"});
                };
                contact.form.email_text.onKillFocus = function ()
                {
                    caurina.transitions.Tweener.addTween(contact.form.bg2, {_alpha: 60, time: 5.000000E-01, transition: "easeOutExpo"});
                };
                contact.form.message_text.onSetFocus = function ()
                {
                    caurina.transitions.Tweener.addTween(contact.form.bg3, {_alpha: 100, time: 5.000000E-01, transition: "easeOutExpo"});
                };
                contact.form.message_text.onKillFocus = function ()
                {
                    caurina.transitions.Tweener.addTween(contact.form.bg3, {_alpha: 60, time: 5.000000E-01, transition: "easeOutExpo"});
                };
                contact.form.sendmail.onRollOver = function ()
                {
                    if (emailsend == false)
                    {
                        caurina.transitions.Tweener.addTween(this.over, {_alpha: 100, time: 8.000000E-01, transition: "easeOutExpo"});
                    } // end if
                };
                contact.form.sendmail.onRollOut = function ()
                {
                    if (emailsend == false)
                    {
                        caurina.transitions.Tweener.addTween(this.over, {_alpha: 0, time: 8.000000E-01, transition: "easeOutExpo"});
                    } // end if
                };
                contact.form.sendmail.onReleaseOutside = function ()
                {
                    if (emailsend == false)
                    {
                        caurina.transitions.Tweener.addTween(this.over, {_alpha: 0, time: 8.000000E-01, transition: "easeOutExpo"});
                    } // end if
                };
                contact.form.sendmail.onRelease = function ()
                {
                    if (emailsend == false)
                    {
                        test();
                    } // end if
                };
                caurina.transitions.Tweener.addTween(contact, {_y: 0, time: 1, transition: "easeInOutExpo"});
            }
            else
            {
                cssloaded = false;
            } // end else if
        };
    }
    else
    {
        xmlloaded = false;
    } // end else if
};