A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Download button

  1. #1
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440

    Download button

    Hello again

    One question. In KE if i click file link i got open 'save' window without any prompt.
    How to do something similiar? Im sure it was asked somewhere but i cant find that :|

    rgrds

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Location
    Tinley Park, IL
    Posts
    702
    It's a setting in your user's browser.

    You'll notice that KE uses zip files. Most browsers default to save these files instead of downloading or opening.

    It's nothing on your side. It's an end user issue.

    But I'm curious as to what you mean about being prompted?
    My Sites: Gaming Site Nightshade Studios MyKM Tutorials

    --------------------------------------------------
    What I'm using: Gimp, Koolmoves, Sepy, HTML-Kit, Inkscape

  3. #3
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    I want to have http://img142.imageshack.us/img142/4726/popupcm3.jpg instead of 'Save'...
    this is not browser setting - any link to file opens that window. but some links opens 'Save' window - and this is not extension specyfic, it belongs to site's code.
    for example, in my WebMail every attachment have got 2 options: Open and Save.
    Open opens it in new window and save opens the "Save" dialog.
    and this is default browser setting - its the same situation on FF and IE (I use Opera).
    so there must be specified code for this, i think its messing with target parameter but... i dont know.

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    It is a browser thing. Using simple links it cannot be done. You can use the filereference commands to open a download dialog.

    Here's the AS2 example from Adobe LiveDocs
    Code:
    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 {
        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.");
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center