Re: [Flashcoders] Send to friend....Doesn't make sense.
what's the difference between lv.onLoad=Delegate.create(this,onEmailResponse); and lv.onLoad=_root.onEmailResponse; i always used functions like this when i want to associate it with a bt event thanks - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Sunday, March 12, 2006 2:12 AM Subject: Re: [Flashcoders] Send to friend....Doesn't make sense. I'm not going to check your email verification but you could do somethign like this for loadvars rather than using loadvariables. Also have your php write back a response so that flash knows whether it worked or not. Some tidbits of advice - your submit mail button should call a validation process - it shouldn't hold it in the scope of its onRelease handler - that might introduce a scoping problem. So create a function that is like validateEmail(emailString), and have your button call it. submit_mail_btn.onRelease=Delegate.create(this,validateEmail). Delegate in Flash 7 and up is your friend. It fies the scope madness. Also, test your validation bit outside of the onRelease and determine where its failing. import mx.utils.Delegate; lv:LoadVars=new LoadVars(); var validEmail=isEmail(email_txt.text); lv.vemail=vemail; lv.onLoad=Delegate.create(this,onEmailResponse); lv.sendAndLoad("../mailinglist.php",lv,"GET") function onEmailResponse(success){ if(p_success){ email.text = "THANK YOU!"; }else{ email.text = "Problem Dude!"; } } function isEmail(str:String):Boolean{ // do your email validation here and return true or false // By creating a function, you can use it again and again - // so your submit buttons should call a validation process, not // hold the validation process in the scope of its onRelease. return(valid) } > Please can Someone take a look at this code and see where I've gone > wrong. I've used this in Flash 6 a million times, ported it to 7 and am > having no luck. Ok I'm loading a send to friend MC into a _blank MC on > the main stage for the actions on this would be, vemail is the variable, > email is the instance: > > thanks much. > > // restrict email field to upper and lower case letters, numbers, @ and > . and excludes " "(space) email.restrict = "A-Z a-z 0-9 @ . \\- _ ^ "; > // > submit_mail_btn.onRelease = function() { > s = new String(email.text); > lastPointIndex = s.lastIndexOf(".")+1; > firstPointIndex = s.indexOf("."); > firstUSIndex = s.indexOf("_"); > firstHyphenIndex = s.indexOf("-"); > emailLength = s.length; > lettersAfterLastDot = emailLength-lastPointIndex; > firstAT = s.indexOf("@"); > lastAT = s.lastIndexOf("@"); > dotAfterAT = s.indexOf(".", lastAT); > onlyOneAt = firstAT-lastAT; // should return 0, check for 0 in if > statement charBeforAt = s.charAt(firstAT-1); > if (charBeforAt != "." && charBeforAt != "_" && charBeforAt != "-") > { > charBeforAtValid = true; > } else { > charBeforAtValid = false; > } > charAfterAt = s.charAt(firstAT+1); > if (charAfterAt != "." && charAfterAt != "_" && charAfterAt != "-") > { > charAfterAtValid = true; > } else { > charAfterAtValid = false; > } > // field check > if (firstAT != -1 && onlyOneAT == 0 && firstAT != 0 && > firstPointIndex != 0 && firstUSIndex != 0 && firstHyphenIndex != 0 > &&charBeforAtValid == true && charAfterAtValid == true && > lettersAfterLastDot>=2 && lettersAfterLastDot<=4) { > > stringToSend = "../mailinglist.php?vemail="+vemail; > trace("stringToSend="+stringToSend); > loadVariables(stringToSend, this, "GET"); > email.text = "THANK YOU!"; > action = "Send"; > //play(); > } else { > // display error message > email.text = "INVALID ADDRESS"; > action = ""; > stop(); > } > }; > > -- > The PHP assoc. with the mail prog. > -- > > > // Enter your email address here > $adminaddress = "[EMAIL PROTECTED]"; > $adminaddress2 = "[EMAIL PROTECTED]"; > > // Enter the address of your website here MUST include http://www. > $siteaddress ="http://www.sireclothing.com";; > > // Enter your company name or site name here > $sitename = "Sire Clothing"; > > // Gets the date and time from your s
Re: [Flashcoders] Send to friend....Doesn't make sense.
Even better than Delegate is Proxy, http://www.person13.com/articles/ proxy/Proxy.htm On 12 Mar 2006, at 05:12AM, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: I'm not going to check your email verification but you could do somethign like this for loadvars rather than using loadvariables. Also have your php write back a response so that flash knows whether it worked or not. Some tidbits of advice - your submit mail button should call a validation process - it shouldn't hold it in the scope of its onRelease handler - that might introduce a scoping problem. So create a function that is like validateEmail(emailString), and have your button call it. submit_mail_btn.onRelease=Delegate.create(this,validateEmail). Delegate in Flash 7 and up is your friend. It fies the scope madness. Also, test your validation bit outside of the onRelease and determine where its failing. import mx.utils.Delegate; lv:LoadVars=new LoadVars(); var validEmail=isEmail(email_txt.text); lv.vemail=vemail; lv.onLoad=Delegate.create(this,onEmailResponse); lv.sendAndLoad("../mailinglist.php",lv,"GET") function onEmailResponse(success){ if(p_success){ email.text = "THANK YOU!"; }else{ email.text = "Problem Dude!"; } } function isEmail(str:String):Boolean{ // do your email validation here and return true or false // By creating a function, you can use it again and again - // so your submit buttons should call a validation process, not // hold the validation process in the scope of its onRelease. return(valid) } Regards, Sam Thorne Interaction Design Web: http://www.native.com/ Tel: +44 (0)207 588 7970 Fax: +44 (0)207 588 7971 ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Send to friend....Doesn't make sense.
I'm not going to check your email verification but you could do somethign like this for loadvars rather than using loadvariables. Also have your php write back a response so that flash knows whether it worked or not. Some tidbits of advice - your submit mail button should call a validation process - it shouldn't hold it in the scope of its onRelease handler - that might introduce a scoping problem. So create a function that is like validateEmail(emailString), and have your button call it. submit_mail_btn.onRelease=Delegate.create(this,validateEmail). Delegate in Flash 7 and up is your friend. It fies the scope madness. Also, test your validation bit outside of the onRelease and determine where its failing. import mx.utils.Delegate; lv:LoadVars=new LoadVars(); var validEmail=isEmail(email_txt.text); lv.vemail=vemail; lv.onLoad=Delegate.create(this,onEmailResponse); lv.sendAndLoad("../mailinglist.php",lv,"GET") function onEmailResponse(success){ if(p_success){ email.text = "THANK YOU!"; }else{ email.text = "Problem Dude!"; } } function isEmail(str:String):Boolean{ // do your email validation here and return true or false // By creating a function, you can use it again and again - // so your submit buttons should call a validation process, not // hold the validation process in the scope of its onRelease. return(valid) } > Please can Someone take a look at this code and see where I've gone > wrong. I've used this in Flash 6 a million times, ported it to 7 and am > having no luck. Ok I'm loading a send to friend MC into a _blank MC on > the main stage for the actions on this would be, vemail is the variable, > email is the instance: > > thanks much. > > // restrict email field to upper and lower case letters, numbers, @ and > . and excludes " "(space) email.restrict = "A-Z a-z 0-9 @ . \\- _ ^ "; > // > submit_mail_btn.onRelease = function() { > s = new String(email.text); > lastPointIndex = s.lastIndexOf(".")+1; > firstPointIndex = s.indexOf("."); > firstUSIndex = s.indexOf("_"); > firstHyphenIndex = s.indexOf("-"); > emailLength = s.length; > lettersAfterLastDot = emailLength-lastPointIndex; > firstAT = s.indexOf("@"); > lastAT = s.lastIndexOf("@"); > dotAfterAT = s.indexOf(".", lastAT); > onlyOneAt = firstAT-lastAT; // should return 0, check for 0 in if > statement charBeforAt = s.charAt(firstAT-1); > if (charBeforAt != "." && charBeforAt != "_" && charBeforAt != "-") > { > charBeforAtValid = true; > } else { > charBeforAtValid = false; > } > charAfterAt = s.charAt(firstAT+1); > if (charAfterAt != "." && charAfterAt != "_" && charAfterAt != "-") > { > charAfterAtValid = true; > } else { > charAfterAtValid = false; > } > // field check > if (firstAT != -1 && onlyOneAT == 0 && firstAT != 0 && > firstPointIndex != 0 && firstUSIndex != 0 && firstHyphenIndex != 0 > &&charBeforAtValid == true && charAfterAtValid == true && > lettersAfterLastDot>=2 && lettersAfterLastDot<=4) { > > stringToSend = "../mailinglist.php?vemail="+vemail; > trace("stringToSend="+stringToSend); > loadVariables(stringToSend, this, "GET"); > email.text = "THANK YOU!"; > action = "Send"; > //play(); > } else { > // display error message > email.text = "INVALID ADDRESS"; > action = ""; > stop(); > } > }; > > -- > The PHP assoc. with the mail prog. > -- > > > // Enter your email address here > $adminaddress = "[EMAIL PROTECTED]"; > $adminaddress2 = "[EMAIL PROTECTED]"; > > // Enter the address of your website here MUST include http://www. > $siteaddress ="http://www.sireclothing.com";; > > // Enter your company name or site name here > $sitename = "Sire Clothing"; > > // Gets the date and time from your server > $date = date("m/d/Y H:i:s"); > > // Gets the IP Address > if ($REMOTE_ADDR == "") $ip = "no ip"; > else $ip = getHostByAddr($REMOTE_ADDR); > > > mail("$adminaddress","Sire Clothing Mailing List SUBSCRIBE", "$vemail > > -- > Using: $HTTP_USER_AGENT > Hostname: $ip > IP address: $REMOTE_ADDR > Date/Time: $date","FROM:$vemail"); > > // Send confirmation to visitor > mail("$vemail","$sitename mailing list confirmation", > " > Thank you for joining the Sire Clothing community! > We look forward to keeping you up to date with updates and news.\r\r > > Sire Clothing\r\r > > You have received this confirmation because you, or someone you know > elected > > to join. If you feel you have received this message in error, accept our > apologies. Simply hit ' Reply' and add \"Unsubscribe\" to either the > subject line or message body and you will be immediately > removedthat's it! > :::
[Flashcoders] Send to friend....Doesn't make sense.
Please can Someone take a look at this code and see where I've gone wrong. I've used this in Flash 6 a million times, ported it to 7 and am having no luck. Ok I'm loading a send to friend MC into a _blank MC on the main stage for the actions on this would be, vemail is the variable, email is the instance: thanks much. // restrict email field to upper and lower case letters, numbers, @ and . and excludes " "(space) email.restrict = "A-Z a-z 0-9 @ . \\- _ ^ "; // submit_mail_btn.onRelease = function() { s = new String(email.text); lastPointIndex = s.lastIndexOf(".")+1; firstPointIndex = s.indexOf("."); firstUSIndex = s.indexOf("_"); firstHyphenIndex = s.indexOf("-"); emailLength = s.length; lettersAfterLastDot = emailLength-lastPointIndex; firstAT = s.indexOf("@"); lastAT = s.lastIndexOf("@"); dotAfterAT = s.indexOf(".", lastAT); onlyOneAt = firstAT-lastAT; // should return 0, check for 0 in if statement charBeforAt = s.charAt(firstAT-1); if (charBeforAt != "." && charBeforAt != "_" && charBeforAt != "-") { charBeforAtValid = true; } else { charBeforAtValid = false; } charAfterAt = s.charAt(firstAT+1); if (charAfterAt != "." && charAfterAt != "_" && charAfterAt != "-") { charAfterAtValid = true; } else { charAfterAtValid = false; } // field check if (firstAT != -1 && onlyOneAT == 0 && firstAT != 0 && firstPointIndex != 0 && firstUSIndex != 0 && firstHyphenIndex != 0 &&charBeforAtValid == true && charAfterAtValid == true && lettersAfterLastDot>=2 && lettersAfterLastDot<=4) { stringToSend = "../mailinglist.php?vemail="+vemail; trace("stringToSend="+stringToSend); loadVariables(stringToSend, this, "GET"); email.text = "THANK YOU!"; action = "Send"; //play(); } else { // display error message email.text = "INVALID ADDRESS"; action = ""; stop(); } }; -- The PHP assoc. with the mail prog. -- http://www. $siteaddress ="http://www.sireclothing.com";; // Enter your company name or site name here $sitename = "Sire Clothing"; // Gets the date and time from your server $date = date("m/d/Y H:i:s"); // Gets the IP Address if ($REMOTE_ADDR == "") $ip = "no ip"; else $ip = getHostByAddr($REMOTE_ADDR); mail("$adminaddress","Sire Clothing Mailing List SUBSCRIBE", "$vemail -- Using: $HTTP_USER_AGENT Hostname: $ip IP address: $REMOTE_ADDR Date/Time: $date","FROM:$vemail"); // Send confirmation to visitor mail("$vemail","$sitename mailing list confirmation", " Thank you for joining the Sire Clothing community! We look forward to keeping you up to date with updates and news.\r\r Sire Clothing\r\r You have received this confirmation because you, or someone you know elected to join. If you feel you have received this message in error, accept our apologies. Simply hit ' Reply' and add \"Unsubscribe\" to either the subject line or message body and you will be immediately removedthat's it! $siteaddress","FROM:$adminaddress2"); ?> - Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com