Safari不会让我输入Flash表单

时间:2012-05-23 08:40:42

标签: php actionscript-3 flash safari

我制作了一个带有联系表格的Flash网站,它可以在我的电脑上使用FireFox,IE和Chrome。但是,在Safari中我似乎无法输入任何文本字段;在Android上,我只能输入大写字母(基本上是大写字母开启,它不会让我改成小写)。

我怀疑问题完全在Flash中,因为发送电子邮件确实可以正常工作。在这里或在Google上搜索不会让我得到任何相关内容。

任何提示?

这是我的代码:

FormScript.as(这是从我的主.as文件调用的外部.as文件)

//***All imports, vars, etc***

function submit(e:MouseEvent):void {

    //Check to see if any of the fields are empty       
        if(yourName.text == "" || fromEmail.text == "" ||
            yourSubject.text == "" ||yourMsg.text == "" ) {
            valid.text = "All fields must be filled";
        }

    //Check if you're using a valid email address       
        else if(!checkEmail(fromEmail.text)) {
            valid.text = "Please fill in an existing email";
        } 

        else { 
            valid.text = "Verzenden.."; 
            var emailData:String = 
            "name=" + yourName.text +
            "&from=" + fromEmail.text +
            "&subject=" + yourSubject.text +
            "&msg=" + yourMsg.text;

            var urlVars:URLVariables = new URLVariables(emailData);
            urlVars.dataFormat = URLLoaderDataFormat.TEXT;
            urlRequest.data = urlVars; varLoad.load( urlRequest );
            varLoad.addEventListener(Event.COMPLETE, thankYou );
        }
    }
    function reset(e:MouseEvent):void {
        init(); //call the initial clear function
    }
    function checkEmail(s:String):Boolean {
        //This tests for correct email address
        var p:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
        var r:Object = p.exec(s);
        if( r == null ) {
            return false;
        }
        return true;
    }   
    function thankYou(e:Event):void { 
        var loader:URLLoader = URLLoader(e.target); 
        var sent = new URLVariables(loader.data).sentStatus;
        if( sent == "yes" ) {
            valid.text = "Thanks for your email!"; timer = new Timer(500);
            timer.addEventListener(TimerEvent.TIMER, msgSent);
            timer.start();
        }
        else {
            valid.text = "Something went wrong, please try again";
        }
    }

    function msgSent(te:TimerEvent):void {
        if(timer.currentCount >= 10) {
        init();
        timer.removeEventListener(TimerEvent.TIMER, msgSent);
    }

用于邮件处理的PHP文件:

<?php
    $yourName = $_POST['name'];
    $fromEmail = $_POST['from'];
    $yourSubject = $_POST['subject'];
    $yourMsg = $_POST['msg'];

    if( $yourName == true ) {
        $sender = $fromEmail;
        $yourEmail ="myemailaddress@example.com"; // Naturally I put in my own email address here :)
        $ipAddress = $_SERVER['REMOTE_ADDR']; // This gets the user's ip Address

        $emailMsg = "Van: $sender\r\n" .
                    "Naam: $yourName\r" .
                    "Subject: my site - $yourSubject\n\n" .
                    "$yourMsg\n\n\n\n" .
                    "------------------------------\r" .
                    "Verstuurd vanaf IP-adres $ipAddress\r" .
                    "X-Mailer: PHP/" . phpversion();
        $return = "From: $sender\r\n";

        if( mail( $yourEmail, "$yourSubject", $emailMsg, $return)) { 
            echo "sentStatus=yes";
        }
        else {
            echo "sentStatus=no";
        }
    }
?>

编辑:

我已成功解决了Android问题。 Safari仍然不允许我输入。

我更改了标题 - 原始问题: “Android上的Flash表单只允许我键入大写字母/ CAPS,safari不会让我输入所有的“

可能适用于Android的技巧部分是在AS3代码中将文本字段设置为.htmlText而不是.text

1 个答案:

答案 0 :(得分:0)

我建议的唯一一件事就是看你是否需要更新你的Flash版本。我之前看到一个问题,我无法输入Firefox并更新Flash解决了它。