1 Reply Latest reply on Jul 2, 2008 9:57 PM by kglad

    Handler Errors

    mattyfuse Level 1
      Hello I am trying to figure out how to incorporate the donwload filereference code with my button - I have clicked actions then placed the code within but am getting errors - It must be { or } but im not sure where to place them - can someone take a look at the code and tell me what I am doing wrong?? Thanks !


      import flash.net.FileReference;


      onRelease{

      var listener:Object = new Object();

      listener.onSelect = function(file:FileReference):Void {
      trace("onSelect: " + file.name);
      }

      listener.onCancel = function(file:FileReference):Void {
      trace("onCancel");
      }

      listener.onOpen = function(file:FileReference):Void {
      trace("onOpen: " + file.name);
      }

      listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
      trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
      }

      listener.onComplete = function(file:FileReference):Void {
      trace("onComplete: " + file.name);
      }

      listener.onIOError = function(file:FileReference):Void {
      trace("onIOError: " + file.name);
      }

      var fileRef:FileReference = new FileReference();
      fileRef.addListener(listener);
      var url:String = " http://www.macromedia.com/platform/whitepapers/platform_overview.pdf";
      if(!fileRef.download(url, "FlashPlatform.pdf")) {
      trace("dialog box failed to open.");
      }

        • 1. Re: Handler Errors
          kglad Adobe Community Professional & MVP
          there is no onRelease{

          there's an on(release){ // attached to a button/movieclip

          and there's an

          yourbutton.onRelease=function(){ // attached to a frame

          and most of that code should not be in an onRelease or on(release. only the url and fileRef.download() methods should be in the onRelease handler.