2 Replies Latest reply on Dec 8, 2006 8:00 AM by koomisan

    problem with filereference

    koomisan
      hi, i am trying to create a downloadable album using the filereference class
      after a while of experimenting i have finally managed to get the files to be uploaded...
      every file thats being downloaded has its progress bar embeded in the dowload btn movie clip, and is called by the filereference class onProgress event.
      the problem is that once you press on a different file to be dowloaded, the progress is shown on the other bar, rather than opening a new one...
      you can take a look and see what i mean...
      (songs 1-5 are downloadable)

      here is the link to the site...
      http://omrihecht.com/temp/nirAlbum/albumenglish.html

      the script that runs it is :

      _root["songName_mc"+num].dnld_btn.onRelease = function() {
      songNum = num;
      var fileRef:FileReference = new FileReference(this);
      fileRef.addListener(fileDownloadListener);
      var url:String = " http://omrihecht.com/temp/nirAlbum/"+theURL;
      //trace('"'+theURL+'"');
      if (!fileRef.download(url)) {
      trace("dialog box failed to open.");
      }
      };
      fileDownloadListener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
      _root["songName_mc"+songNum].onEnterFrame = function() {
      if (bytesLoaded<bytesTotal) {
      this.loadProgressBar._visible = true;
      if (this.loadProgressBar._alpha<100) {
      this.loadProgressBar._alpha += 10;
      }
      var loadPercent:Number = (bytesLoaded/bytesTotal)*100;
      this.loadProgressBar.loadProgressColor._xscale = loadPercent;
      } else {
      //trace("complete");
      if (this.loadProgressBar._alpha>0) {
      this.loadProgressBar._alpha -= 10;
      } else {
      delete this.onEnterFrame;
      }
      }
      };
      };