A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Downloading an image

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    20

    Downloading an image

    Hi, I have this file which it's supposed to be able to download image when I upload to server.

    Can anyone help me check if the codes is correct? Cause I'm really not very sure about it.

    Much appreciated.
    Attached Files Attached Files

  2. #2
    Junior Member
    Join Date
    Dec 2009
    Posts
    20
    Can someone kindly help out?
    really need to know if it's the correct way (I used getURL) but it doesn't seem to work.

  3. #3
    Programmer
    Join Date
    Aug 2007
    Posts
    173
    when you press one of the buttons (eg) "1280x1024" ..do you want it to bring a dialog box saying. save ?

    if so :

    remove the geturl from the button and frame
    place this where you had the 'image.onRelease' frame

    Code:
    image.onRelease = function() {
    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 = "coke.jpg";
    if(!fileRef.download(url)) {
        trace("dialog box failed to open.");
    }
    
    }
    Last edited by hunty93; 01-06-2010 at 11:35 AM.
    Freelance: AS2, AS3, PHP, MySQL, JavaScript
    Skype: hunty93

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