-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? –