1 Reply Latest reply on Jun 13, 2011 6:29 AM by UbuntuPenguin

    Destroying a File Reference Object in Flex 4

    linrsvp

      I have many states within my main application, one state adds an  inventory into the database, and another edits inventories. The form  that allows a user to add inventory details, also allows the user to  upload an attachment.

       

      The edit and add forms are the same. In this particular case, when i  edit an inventory by uploading an attachment, the FileReference Object  get populated and e'thing works fine.

       

      I then click on the 'Add Inventory' link, (application changes to  'add' state). Here however, the FileReference Object contains info abt  the previos upload, and hence this filename gets inserted along with the  new inventory details into the database.

      I tried several options : 1. on the enterState event of the 'add' state, I set the FileReference object to null 2. on the enterState event of the 'add' state, I create a new instance of the filereference object.

      Both these methods do not work. How do i destroy the filereferenceobject ??