[Flashcoders] [AS3] FileReference.download()

2008-03-13 Thread ntasky

Hi.
simply trying  to download files such as .zip or .pdf.
The dialog box which tells me wher i want to download the file appears, i 
click OK, the dialog box closes and nothing is downloaded.


files are on the same server.

Did someone has a similar issue ?

thx,

N.

here is my code:
package
{
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.events.IOErrorEvent;

public class FileListItem extends MovieClip
{
private var _fileToDownload :FileReference;

public function FileListItem(p_fileLocation:String)
{
_fileToDownload = new FileReference();
btDownload.addEventListener(MouseEvent.CLICK, 
_onDownload);
};

private function _onDownload(p_evt:MouseEvent):void
{
_fileToDownload.addEventListener(IOErrorEvent.IO_ERROR, 
_onIOError)
_fileToDownload.download(new URLRequest(_fileLocation), 
_fileLocation);
}

private function _onIOError(p_evt:IOErrorEvent):void
{
trace (p_evt);
}
}
}


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] [AS3] FileReference.download()

2008-03-13 Thread Helmut Granda
What browser? MAC PC? have you tried to download other files successfully
besides pdf and zip files with the same code?

On 3/13/08, ntasky [EMAIL PROTECTED] wrote:

 Hi.
 simply trying  to download files such as .zip or .pdf.
 The dialog box which tells me wher i want to download the file appears, i
 click OK, the dialog box closes and nothing is downloaded.

 files are on the same server.

 Did someone has a similar issue ?

 thx,

 N.

 here is my code:
 package
 {
 import flash.display.MovieClip;
 import flash.display.SimpleButton;
 import flash.events.MouseEvent;
 import flash.net.FileReference;
 import flash.net.URLRequest;
 import flash.events.IOErrorEvent;

 public class FileListItem extends MovieClip
 {
 private var _fileToDownload :FileReference;

 public function FileListItem(p_fileLocation:String)
 {
 _fileToDownload = new FileReference();
 btDownload.addEventListener(MouseEvent.CLICK,
 _onDownload);
 };

 private function _onDownload(p_evt:MouseEvent):void
 {
 _fileToDownload.addEventListener(
 IOErrorEvent.IO_ERROR, _onIOError)
 _fileToDownload.download(new
 URLRequest(_fileLocation), _fileLocation);
 }

 private function _onIOError(p_evt:IOErrorEvent):void
 {
 trace (p_evt);
 }
 }
 }


 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
...helmut
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] [AS3] FileReference.download()

2008-03-13 Thread Bob Leisle

Hi Ntasky,

I'm not sure if this is the only cause to the problem, but I did notice 
this. Your _onDownLoad handler is using _fileLocation, which is not 
defined anywhere in your code.


hth,
Bob

ntasky wrote:

Hi.
simply trying  to download files such as .zip or .pdf.
The dialog box which tells me wher i want to download the file 
appears, i click OK, the dialog box closes and nothing is downloaded.


files are on the same server.

Did someone has a similar issue ?

thx,

N.

here is my code:
package
{
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.events.IOErrorEvent;

public class FileListItem extends MovieClip
{
private var _fileToDownload:FileReference;

public function FileListItem(p_fileLocation:String)
{
_fileToDownload = new FileReference();
btDownload.addEventListener(MouseEvent.CLICK, _onDownload);
};

private function _onDownload(p_evt:MouseEvent):void
{
_fileToDownload.addEventListener(IOErrorEvent.IO_ERROR, 
_onIOError)
_fileToDownload.download(new URLRequest(_fileLocation), 
_fileLocation);

}

private function _onIOError(p_evt:IOErrorEvent):void
{
trace (p_evt);
}
}
}


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





--
Thanks,
~
Bob Leisle 
Headsprout Software  Engineering

http://www.headsprout.com
Where kids learn to read! 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] [AS3] FileReference.download()

2008-03-13 Thread ntasky

hello bob,

your absolutely right but unfortunatly for me it just that i forgot to 
copy/paste it...

good catch thought :)

N.

public function FileListItem(p_fileLocation:String)
{
   _fileToDownload = new FileReference();
   _fileLocation = p_fileLocation;
   btDownload.addEventListener(MouseEvent.CLICK, _onDownload);
};

--
From: Bob Leisle [EMAIL PROTECTED]
Sent: Thursday, March 13, 2008 4:16 PM
To: Flash Coders List flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] [AS3] FileReference.download()


Hi Ntasky,

I'm not sure if this is the only cause to the problem, but I did notice 
this. Your _onDownLoad handler is using _fileLocation, which is not 
defined anywhere in your code.


hth,
Bob

ntasky wrote:

Hi.
simply trying  to download files such as .zip or .pdf.
The dialog box which tells me wher i want to download the file appears, i 
click OK, the dialog box closes and nothing is downloaded.


files are on the same server.

Did someone has a similar issue ?

thx,

N.

here is my code:
package
{
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.events.IOErrorEvent;

public class FileListItem extends MovieClip
{
private var _fileToDownload:FileReference;

public function FileListItem(p_fileLocation:String)
{
_fileToDownload = new FileReference();
btDownload.addEventListener(MouseEvent.CLICK, _onDownload);
};

private function _onDownload(p_evt:MouseEvent):void
{
_fileToDownload.addEventListener(IOErrorEvent.IO_ERROR, 
_onIOError)
_fileToDownload.download(new URLRequest(_fileLocation), 
_fileLocation);

}

private function _onIOError(p_evt:IOErrorEvent):void
{
trace (p_evt);
}
}
}


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





--
Thanks,
~
Bob Leisle Headsprout Software  Engineering
http://www.headsprout.com
Where kids learn to read!
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders