2013-09-25 19 views
0

我有一个横幅,我有一个联系表单。如果某些字段为空,并且用户尝试提交,横幅将返回响应。但由于某些原因,响应文本会中断或丢失字母。Flash响应文本中断,丢失字母

Should be: Täname "name", päringu eest

/*ActionScript 3.0 */ 

name_txt.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler); 

function fl_MouseClickHandler(event:MouseEvent):void { 

trace("Mouse clicked"); 

stop(); 

} 

// custom function we create to populate the comboBox list 
function addShopsToList():void { 
shopList.addItem({ label: "Esindus1" }); 
shopList.addItem({ label: "Esindus2" }); 
shopList.addItem({ label: "Esindus3" }); 
shopList.addItem({ label: "Esindus4" }); 
} 
// Run function above now 
addShopsToList(); 

// build variable name for the URL Variables loader 
var variables:URLVariables = new URLVariables; 

// Build the varSend variable 
var varSend:URLRequest = new URLRequest("form_parse.php"); 
varSend.method = URLRequestMethod.POST; 
varSend.data = variables; 

// Build the varLoader variable 
var varLoader:URLLoader = new URLLoader; 
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES; 
varLoader.addEventListener(Event.COMPLETE, completeHandler); 

// handler for the PHP script completion and return of status 
function completeHandler(event:Event):void { 
// remove processing clip 
name_txt.text = ""; 
email_txt.text = ""; 
phone_txt.text = ""; 

// Load the response from php here 
status_txt.text = event.target.data.return_msg; 
} 

// Add event listener for submit button click 
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend); 

// function ValidateAndSend 
function ValidateAndSend (event:MouseEvent):void { 

// validate fields 
if(!name_txt.length) { 
    status_txt.text = "Please enter your name"; 
} else if (!email_txt.length) { 
    status_txt.text = "Please enter your email"; 
} else if (!phone_txt.length) { 
    status_txt.text = "Please enter your phone number"; 
} else { 

    // All is good, send the data now to PHP 

    // ready the variables in our form for sending 
    variables.userName = name_txt.text; 
    variables.userEmail = email_txt.text;  
    variables.userPhone = phone_txt.text; 
    variables.userShop = shopList.value; 

    // Send the data to PHP now 
    varLoader.load(varSend); 

} // close else condition for error handling 

} // close validate and send function 

PHP:在成功的提交:

$my_msg = "Täname $senderName, päringu eest."; // Thanking the user for successful completion 
// Print the data back to flash who is patiently waiting for it in the onCompleteHandler 
print "return_msg=$my_msg"; 

任何想法?

+0

你看到什么而不是'$ my_msg'? – Cherniv

+0

我得到:“Tnmetinpinueest。”但是当我复制并粘贴文本到记事本时,它是“Täname”名称,“päringueest”,这是正确的。 – Laniakea

+2

这意味着您需要将特定字体嵌入到您的文本字段 – Cherniv

回答

0

正如切尔诺夫所说,你需要嵌入你使用的字体为你的文本框。嵌入做以下

Open Character Panel Window > Character 

enter image description here

enter image description here

希望帮助

干杯!

+0

是的,切尔诺夫指引我走在正确的道路上。此外,我需要将“拉丁字母”字符范围包含在“虚线”字母中。 – Laniakea