我在移动设备上加载了 URLRequest。如果互联网参差不齐,它就会停止。大多数时候它可以工作,但有时它会卡在一定的百分比上。有没有办法查看加载是否已停止并在 3 秒后“重试”或类似的东西?它也可以尝试 10 次,然后抛出错误消息以便我可以告诉用户吗?
public function loadIt()
{
var theImage = "http://www.Example.com/Example.png"; // real url not given here
my_loader.load(new URLRequest(theImage));
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, startListener);
my_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
if(autoPlayAd=="true")
{
playAd();
}
}
public function progressListener(e:ProgressEvent):void
{
loadingStatus.Per.text = Math.floor((e.bytesLoaded/e.bytesTotal)*100)+ "%";
}