2013-02-23 35 views
4

我使用URLRequest在Flash中加載外部php文件。但不幸的是我得到這個錯誤 -ReferenceError:錯誤#1069:在字符串中找不到屬性,並且沒有默認值

ReferenceError: Error #1069:Property email not found on String and there is no default value. 
    at Main/variablesGot() 
    at flash.events::EventDispatcher/dispatchEventFunction() 
    at flash.events::EventDispatcher/dispatchEvent() 
    at flash.net::URLLoader/onComplete() 

下面是相關AS3代碼

phpLoader.addEventListener(Event.COMPLETE, variablesGot);  
private function variablesGot(ev:Event):void 

    { 
     trace(ev.target.data.toString()); //THIS OUTPUTS CORRECTLY 
     //OUTPUT for this trace is as follows 
     //athleteName=ankur&[email protected]&password=newpass&personalBest=9.58&shirtNumber=10   

     trace(ev.target.data.email.toString()); //LINE WITH ERROR 
    } 

這裏從PHP文件相關的PHP代碼,我加載

print "athleteName=".$_SESSION[athleteName]; 
print "&email=".$_SESSION[email]; 
print "&password=".$_SESSION[password]; 
print "&personalBest=".$_SESSION[personalBest]; 
print "&shirtNumber=".$_SESSION[shirtNumber]; 
print "&country=".$_SESSION[country]; 

我想錯誤可能是由於我在PHP中打印的方式?但我不確定。

回答

7

默認情況下,URLLoader將數據加載爲文本,因此原始String上不存在email。試試設置:

phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES; 
相關問題