0 Replies Latest reply on Jun 28, 2006 8:52 AM by sadsan

    Downloading Non http files using FileReference

      Hi everyone

      Need some help with a Auto Run CD I’m creating for my work!! A media pack.

      Making a button for people to be able to download files to there PC, that once pressed will open a dialog box that asks the user for the destination they want to download the file to.

      i.e Sat on the CD are loads of images. From the flash movie they can click on the image they like and it’ll download where they want, desktop, myDocs wherever………..

      Been playing around with this script from the help files but I really don’t know what I’m doing!! Got a feeling I’m close tho

      But I need it, not to upload from a website but from the CD?

      import flash.net.FileReference;

      var listener:Object = new Object();

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

      listener.onCancel = function(file:FileReference):Void {

      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();
      var url:String = " http://www.macromedia.com/platform/whitepapers/platform_overview.pdf";
      if(!fileRef.download(url, "FlashPlatform.pdf")) {
      trace("dialog box failed to open.");