# Btn to Cancel FileReference download

**URL:** <https://forum.kirupa.com/t/btn-to-cancel-filereference-download/187749>\
**Category:** flash\
**Created:** [May 2, 2006, 2:06am UTC](https://forum.kirupa.com/t/btn-to-cancel-filereference-download/187749 "2006-05-02T02:06:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickf828](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@nickf828](https://forum.kirupa.com/u/nickf828)\
**Post date:** [May 2, 2006, 2:06am UTC](https://forum.kirupa.com/t/btn-to-cancel-filereference-download/187749/1 "2006-05-02T02:06:36Z")

</div>

Hi, I can’t figure out how to make a button cancel downloads started using FileReference. Below is the code that is used to start the download. If you could let me know the right code to put in the on(release) of my cancel button that would be great. Thanks!

import flash.net.FileReference;  
var listener:Object = new Object();  
listener.onCancel = function(file:FileReference):Void {  
//the code for what to do when user hits cancel on dialogue box  
};  
listener.onOpen = function(file:FileReference):Void {  
//etc etc these listeners go on  
};
