motome
11-05-2008, 04:56 PM
ok I am sure this has been asked alot, but the serch function is not being kind.. so.. here it goes. I created an app to help not so computer savvy users download a file. I would like to do 2 things with it.
1. Make it so it doesnt open a new webpage, and show the link to the file.
2. Somehow write it so we can put it on our FTP server and have the app log into and Download the file fromt he FTP rather than putting it on our http server. If it helps here is my current working code.
stop();
var _fileName:String = "this is stupid";
var _passwordField:String;
var _passwordHolder:String = "mypassword";
download_btn.addEventListener(MouseEvent.CLICK, getFileName);
download_btn.addEventListener(MouseEvent.CLICK, downloadFile);
download_btn.addEventListener(MouseEvent.CLICK, downloadTheFile);
function getFileName(event:MouseEvent):void {
_fileName = fileName_txt.text;
_passwordField = password_txt.text;
}
function downloadFile(event:MouseEvent):void {
//getUrl("your.pdf","_blank", "GET");
trace(_fileName);
trace(_passwordField);
}
function downloadTheFile(event:MouseEvent):void {
if (_passwordHolder == _passwordField) {
var downloadFileURL:URLRequest = new URLRequest("http://video.sonew.tv/ftpcheat/" + _fileName);
navigateToURL(downloadFileURL);
} else {
gotoAndPlay(2);
}
}
1. Make it so it doesnt open a new webpage, and show the link to the file.
2. Somehow write it so we can put it on our FTP server and have the app log into and Download the file fromt he FTP rather than putting it on our http server. If it helps here is my current working code.
stop();
var _fileName:String = "this is stupid";
var _passwordField:String;
var _passwordHolder:String = "mypassword";
download_btn.addEventListener(MouseEvent.CLICK, getFileName);
download_btn.addEventListener(MouseEvent.CLICK, downloadFile);
download_btn.addEventListener(MouseEvent.CLICK, downloadTheFile);
function getFileName(event:MouseEvent):void {
_fileName = fileName_txt.text;
_passwordField = password_txt.text;
}
function downloadFile(event:MouseEvent):void {
//getUrl("your.pdf","_blank", "GET");
trace(_fileName);
trace(_passwordField);
}
function downloadTheFile(event:MouseEvent):void {
if (_passwordHolder == _passwordField) {
var downloadFileURL:URLRequest = new URLRequest("http://video.sonew.tv/ftpcheat/" + _fileName);
navigateToURL(downloadFileURL);
} else {
gotoAndPlay(2);
}
}