-5
我試圖使用URLLoader
對象從我的Web服務器加載遠程內容。爲此,我使用了Adobe幫助中的example代碼。加載遠程內容時出現「錯誤#2032:流錯誤」
這裏是我的嘗試:
var loader:URLLoader;
loader = new URLLoader();
configureListeners(loader);
var request:URLRequest = new URLRequest("http://www.fashionboxpk.com/Test2.php");
try
{
loader.load(request);
}
catch (error:Error)
{
trace("Unable to load requested document.");
}
function configureListeners(dispatcher:IEventDispatcher):void
{
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
function completeHandler(event:Event):void
{
var loader:URLLoader = URLLoader(event.target);
trace("completeHandler: " + loader.data);
}
function openHandler(event:Event):void
{
trace("openHandler: " + event);
}
function progressHandler(event:ProgressEvent):void
{
trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
}
function securityErrorHandler(event:SecurityErrorEvent):void
{
trace("securityErrorHandler: " + event);
}
function httpStatusHandler(event:HTTPStatusEvent):void
{
trace("httpStatusHandler: " + event);
}
function ioErrorHandler(event:IOErrorEvent):void
{
trace("ioErrorHandler: " + event);
}
但是編譯時,我得到這樣的輸出:
openHandler: [Event type="open" bubbles=false cancelable=false eventPhase=2]
progressHandler loaded:384 total: 384
Error opening URL 'http://www.fashionboxpk.com/Test2.php'
httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=406 responseURL=null]
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.fashionboxpk.com/Test2.php"]
那麼,怎樣才能避免我這些錯誤,並正確加載的內容?
看起來在[http://www.fashionboxpk.com/crossdomain.xml](http:/)上不存在crossdomain.xml /www.fashionboxpk.com/crossdomain.xml) –
歡迎來到堆棧溢出。請閱讀[this](http://stackoverflow.com/questions/ask/advice)瞭解誰提出了很好的問題。好的問題在SO上得到了很好的答案。不好的問題往往會被忽略。 –
這是一個問題嗎?解釋你真的**在這裏嘗試實現...使用AS3打開瀏覽器選項卡中的PHP頁面?或者將php頁面內容讀入AS3? –