SOURCE
http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm
?context=LiveDocs_Parts&file=00002210.html 

NOTES
        -       Max 100 MB for download
        -       Only 1 download at a time

//
//
//              
//

import flash.net.FileReference;

var listener:Object = new Object();
var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);

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);
}

//
//
//              
//


function downloadFile ()
{
        var url:String = "http://www.MYDOMAIN/DIR/FILENAME.jpg";;
        var success = fileRef.download (url, "savedFileName.jpg");
        if ( success )
        {
                trace ("dialog box opened.");
        }
        else
        {
                trace ("dialog box failed to open!");
        }
}

btn.onPress = downloadFile;





-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Corban
Baxter
Sent: Monday, September 10, 2007 9:32 AM
To: Flashcoders mailing list
Subject: [Flashcoders] OT: Force download PDF

hey if I put a pdf link i flash and I saw. getURL("mypdf.pdf"); it keeps
trying to open it in the browser. how can i force the browser to download
the pdf?

-- 
Corban Baxter
http://www.projectx4.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to