Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get a working progress bar for file download AS3
    primarykey
    data
    text
    <p>I'm currently enrolled in an ActionScript course, and cannot seem to get my progress bar to work correctly. We were tasked with creating a simple image loader application, which would access externally hosted images (through use of a PHP proxy script), and then spit the image onto the user's screen (with a progress event and progress bar to track the image's download progress).</p> <p>However, when I run it, I get these mysterious black graphical glitches everywhere, as well as a non-functioning progress bar. In some browsers I get the following error: "ArgumentError: Error #2109: Frame label NaN not found in scene NaN. at flash.display.MovieClip/gotoAndStop() at Document/imageLoadProgress().</p> <p>Here is my code - I cant for the life of me figure out what is wrong. I figure it has something to do with the imageLoadProgress() function, or my progress bar (which is just a simple 100-frame movie clip with a motion tween and a "stop()" command at the beginning).</p> <pre><code>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 &lt; 1) { this.progressBar.gotoAndStop(1); } else { this.progressBar.gotoAndStop(percentLoaded); } //end imageLoadProgress } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload