0 Replies Latest reply on Mar 7, 2007 10:18 AM by bvillanyi

    Need help with fileRef please!

    bvillanyi Level 1
      I am trying to add a control to my Flash movie so the viewer can save the movie on their computer. I followed the help and looked in the forum and came up with the following scipt attached to a button:

      on (release) {
      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 {

      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);
      tf.text="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();
      var url:String = " http://www.mydomain.com/my_movie.swf";
      if(!fileRef.download(url, "myMovie.swf")) {
      trace("dialog box failed to open.");

      The button works when I run the my_movie.swf file on my computer, but when I load the file onto our staging web server and run it using the browser interface, the little text box that shows the progress remains blank and the movie never saves, even though I get the "Select location for download" dialog box.

      I have tried using FireFox 1.5 and Internet Explorer 7.0

      Can anyone please help? I am relatively new to Flash and usually get things done by looking at examples and reading the help. So far that approach has worked, but this time I'm stumped.

      Thanks in advance,
      Beth Villanyi