A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Time delay

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    9

    Time delay

    This is code i used for saving pictures to user computer on button click:
    Code:
    // Create a new instance of the FileReference class to work with.
    var myfileReference:FileReference = new FileReference();
    
    // Create a new URLRequest object specifying the location or URL of the download file.
    // URL
    // var myRequest:URLRequest = new URLRequest("htp://ww.flashwonderland.com/index.html");
    // relative location
    var myRequest:URLRequest = new URLRequest("htp://ww.mywebsite.com/picture.png");
    
    function downloadFile (event:MouseEvent):void {
    
    	// Call the download method with the URLRequest object as the parameter.
    	myfileReference.download(myRequest);
    	
    }
    
    // Hook up the button with the function downloadFile
    goBTN.addEventListener(MouseEvent.CLICK, downloadFile);
    On goBTN (button) click it shows saving window at the same time.
    Can showing window be delayd for 3 second?

  2. #2
    Senior Member
    Join Date
    Jan 2009
    Posts
    208
    use a timer to delay call to

    myfileReference.download(myRequest);

    although now that i have mentioned that, maybe you will have problems with initiating download out of the mouse click event, but on that later.

    i had problems with this recenlty, using the save method, i had to split mouse click into mouse up and down.

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