Hello everyone,
I am still pretty new to action script (especially AS3), but I have doing my best to create a flash-based website. I recently uploaded it to my server to test it, only to discover some odd errors. I have found this site and forum to be very helpful for tutorials in the past, so I decided to register in hopes someone here can help explain whats wrong with the code.
Basically, I have 2 issues:
-
I have 2 text boxes with UIScrollbar components attached. The scrollbars appear and work fine when I test the swf, but when I upload it and view it in a brower (tried IE, Firefox, and Chrome) the scrollbars don’t appear. The textbox itself is there, and you can scroll them with the mousewheel, but the UIScrollbars are not visible. Any advice? There really isnt any code to post, since they are just components, but any other info I can provide just ask and I will.
-
My second issue is a little more complicated for a beginner like myself. I’m trying to create a contact page using a php file, and I did so by following a tutorial. My contact page has a space for a message, your email, and a send button. When you click the send button, I wanted it to clear the 2 boxes.
The code seems to work, the boxes clear when it’s sent, and I get a message saying it’s sent, but I never receive the email. My server host supports php so that isnt the problem. Any advice?
AS code:
stop();
pagetear.visible = false;
//Var for Email form Code
var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("mailexample.php");
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
function completeHandler(event:Event):void
{
email_txt.text = "";
message_txt.text = "";
//status_txt.text = event.target.data.return_msg;
}
function sendForm (event:MouseEvent):void
{
if(validateEmail(email_txt.text)==true){
if(!email_txt.length) {
status_txt.text = "Please complete email"
pagetear.visible = false;
} else if(!message_txt.length) {
status_txt.text = "Please enter a message"
pagetear.visible = false;
} else {
variables.userEmail = email_txt.text;
variables.userMessage = message_txt.text;
varLoader.load(varSend);
pagetear.visible = true;
pagetear.gotoAndPlay(2);
pageSound.play();
}
}
}
function validateEmail(emailString:String):Boolean
{
var myRegEx:RegExp =/(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
var myResult:Object = myRegEx.exec(emailString);
if(myResult == null){
return false;
}
return true;
}
send_btn.addEventListener(MouseEvent.CLICK, sendForm);
var pagetearRequest:URLRequest = new URLRequest("Sounds/pagerip.mp3");
var pageSound:Sound = new Sound();
pageSound.load(pagetearRequest);
PHP code:
<?php
//$senderName = $_POST['userName'];
$senderEmail = $_POST['userEmail'];
$senderMessage = $_POST['userMessage'];
//$senderName = stripslashes($senderName);
$senderEmail = stripslashes($senderEmail);
$senderMessage = stripslashes($senderMessage);
$to = "removed my email for this post";
$from = "$senderEmail";
$subject = "Email from your site";
$message = "Info from site:
//Name: $senderName
Email: $senderEmail
They said:
$senderMessage";
$headers = "From: $from
";
$headers = "Content-type: text
"
mail($to,$subject,$message,$headers);
exit();
?>
Sorry for the lengthy post, just wanted to be clear. If there is any other info I could provide just ask and I will try. I really appreciate any help you can provide, thanks.