現在、ActionScriptコースに登録されており、プログレスバーが正常に動作しないようです。私たちは、(PHPプロキシスクリプトを使用して)外部からホストされた画像にアクセスする単純な画像ローダアプリケーションを作成し、その画像をユーザの画面に吐き出すように指示されました(進行状況イベントとプログレスバーを使って画像のダウンロード進行状況を追跡します)。ファイルをダウンロードするための作業進行状況バーが表示されませんAS3
しかし、私はそれを実行すると、どこでも不思議な黒のグラフィカルグリッチと機能しないプログレスバーが表示されます。一部のブラウザでは、次のエラーが表示されます。 "ArgumentError:Error#2109:Frame NaNがScene NaNに見つかりません。flash.display.MovieClip/gotoAndStop()at Document/imageLoadProgress()。
私の生活の中で何が間違っているのか分かりませんが、imageLoadProgress()関数、またはプログレスバー(モーショントゥイーンと "ストップ(冒頭)」コマンド)
public function loadImage()
{
var imageURL:String = imageArray[currentImageIndex];
if(loaderInfo.url.substr(0,4) == "http")
{
trace("we're online");
//use the proxy script
//escape() will replace spaces in file names with %20
imageURL = "./image_proxy.php?filename=" + escape(imageArray[currentImageIndex]);
}
var imageRequest:URLRequest = new URLRequest(imageURL);
this.imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.imageIOError);
this.imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, this.imageLoadProgress);
this.imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.imageLoadComplete);
this.imageLoader.load(imageRequest);
//end loadImage
}
public function imageIOError(e:Event)
{
trace("ImageIOError called. Error=" + e);
//end imageIOError
}
public function imageLoadProgress(e:ProgressEvent)
{
var percentLoaded:Number = e.bytesLoaded/e.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
//this.progress_mc.scaleY = percentLoaded;
if (percentLoaded < 1)
{
this.progressBar.gotoAndStop(1);
}
else
{
this.progressBar.gotoAndStop(percentLoaded);
}
//end imageLoadProgress
}
こんにちは、返信いただきありがとうございます!このコメントボックスにスクリプトを入れることができないので、ここにはPHPプロキシのペーストビンコピーhttp://pastebin.com/vVZYgrbfがあります。また、コードサンプルをありがとう! loadImage()関数またはimageLoadProgress()関数の先頭に貼り付けていますか? – Prefix
imageLoadProgress()の最後の 'if(percentLoaded <1)'ブロックの代わりに。私は後でPHPのスクリプトを見て、あなたに戻ってきます。 – weltraumpirat
私は今PHPスクリプトを見てきました: 'header(" Content-Length: ".filesize($ fileName));' 'ヘッダ( 'content-type ...')の下に設定してみてください。 – weltraumpirat