FileReference and Scope

For the first time today i used FileReference in Actionscript. There are multiple uses of this but the one i was interested in concerned downloading. I jumped into *Flash's intuitive help section* and attempted to perform the desired outcome (saving an mp3 file locally).

So it all worked great, until i tried to save the file. Nothing happened after pressing save in the dialog box. Turns out the culprit was scope. I created a local function instance of FileReference instead of creating a class instance. When the dialog box opens it needs a reference it can get back to otherwise it's lost and the operation can never be completed.

For a more structured walkthrough check out Adobe's help on the matter.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Comments are closed