我正在开发一个文件管理器,该文件管理器使用我自己的类“ ServConnect”连接到FTP服务器。调用downloadFTPIcon()时出现错误#1009; myListenerFunctionreq侦听器内部的函数。实际函数(downloadFTPIcon)在myListenerFunctionreq函数之外。它与其他功能在同一帧。
我尝试通过删除所需的String参数来简化该函数。我也尝试过组合功能。
https://7*snipped*8.mktorest.com/rest/v1/leads.json?access_token=*snipped*?content-type=application/json&action=createOrUpdate&lookupField=email&firstName=${Contacts.First Name}&lastName=${Contacts.Last Name}&email=${Contacts.Email}
function fetchFTPIcon():void {
var reqFTP:ServConnect;
reqFTP = new ServConnect(curObj._server, curObj._user, curObj._pass, curObj._port);
reqFTP.listener = myListenerFunctionreq;
ico.gotoAndStop(10);
var isError:Boolean = false;
function myListenerFunctionreq(e):void {
if (e.type == "loginSuccess") {
//if(MovieClip(parent).curNetworkDirPath.slice(0,2) == "//") {
//trace(String("is double slash "+MovieClip(parent).curNetworkDirPath.slice(1, MovieClip(parent).curNetworkDirPath.length))+"/"+globalNetworkName)
//reqFTP.showFile(String(MovieClip(parent).curNetworkDirPath.slice(1, MovieClip(parent).curNetworkDirPath.length))+"/"+globalNetworkName);
//} else {
//trace(String("no double slash "+MovieClip(parent).curNetworkDirPath.slice(1, MovieClip(parent).curNetworkDirPath.length))+"/"+globalNetworkName)
reqFTP.showFile("/ServConnectMeta.xml");
//}
} else if (e.type == "error" || e.type == "directoryFaild") {
reqFTP.closeWhenReady();
isError = true;
ico.gotoAndStop(7);
} else if (e.type == "gotFile") {
if(!isError) {
//fileBA = e.byteArray;
//ico.image.loadFromBytes(e.byteArray);
reqFTP.closeWhenReady();
var curMetaFile:XML = XML(e.str);
if(curMetaFile.hasOwnProperty("icon")) {
if(String(curMetaFile.icon).length > 2) {
iconLocNetwork = curMetaFile.icon.toString();
downloadFTPIcon();
} else {
ico.gotoAndStop(7);
}
} else {
ico.gotoAndStop(7);
}
}
} else if (e.type == "gotFileSize") {
trace("GOT FILE SIZE! == "+e.str);
} else if (e.type == "progress") {
//trace(e.msg);
}
}
}
function downloadFTPIcon():void {
var reqFTP:ServConnect;
...
答案 0 :(得分:1)
更新:我已经重写了代码,现在一切正常。
function fetchFTPIcon():void {
if(currentlyActive) {
var propFound:Boolean = false;
for (var i:uint; i < MovieClip(root).uploadTasks.length; i++) {
if(Object(MovieClip(root).uploadTasks[i]).displayName == "FTP details "+naam.text+" opvragen...") {
propFound = true;
}
}
if(!propFound) {
var uplTask:Object = new Object();
uplTask.hasPriority = true;
uplTask.displayName = "FTP details "+naam.text+" opvragen...";
uplTask.origin = "fetchFTPIcon";
uplTask.appNaam = "Bestanden";
uplTask.icon = "files";
uplTask.running = true;
MovieClip(root).uploadTasks.push(uplTask);
}
}
if(currentlyActive) {
var reqFTP:ServConnect;
reqFTP = new ServConnect(curObj._server, curObj._user, curObj._pass, curObj._port);
reqFTP.listener = myListenerFunctionreq;
ico.gotoAndStop(10);
}
var isError:Boolean = false;
function myListenerFunctionreq(e):void {
if (e.type == "loginSuccess") {
if(currentlyActive) {
reqFTP.showFile("/ServConnectMeta.xml");
}
} else if (e.type == "gotFile") {
if(currentlyActive) {
reqFTP.closeWhenReady();
trace("got File!!!!!!!!!!!!!! FTP NAME == "+naam.text+" && "+e.str);
var metaXML:XML = XML(e.str);
if(metaXML.hasOwnProperty("icon")) {
if(String(metaXML.icon).length > 3) {
trace("got icon Now downloading!!!!!!!!!!!!!! FTP NAME == "+naam.text);
var icoLoc:String = metaXML.icon;
var icoFTP:ServConnect;
icoFTP = new ServConnect(curObj._server, curObj._user, curObj._pass, curObj._port);
icoFTP.listener = myListenerFunctionreq;
function myListenerFunctionreq(e):void {
if (e.type == "loginSuccess") {
if(currentlyActive) {
icoFTP.showFile(icoLoc);
}
} else if (e.type == "gotFile") {
if(currentlyActive) {
ico.image.loadFromBytes(e.byteArray);
trace("Icon downloaded. Now generating...")
}
} else if (e.code == 550) {
if(currentlyActive) {
ico.gotoAndStop(7);
icoFTP.closeWhenReady();
}
}
}
}
}
}
} else if (e.code == 550) {
if(currentlyActive) {
reqFTP.closeWhenReady();
ico.gotoAndStop(7);
}
}
}
}