PDA

View Full Version : I think I found an AIR bug.


halfasleeps
03-12-2008, 08:49 PM
when ever I create a File inside a function in adds funciton Function() {} before and after my file path.

say I have this function:

var tmpStr:String;
var tmpArr:Array;
function copyFile(file){
trace("Attempting to copy file");
var sourceFile:File = file;
trace("sourceFile:"+sourceFile);
tmpStr = file.url;
tmpArr = tmpStr.split("/");
tmpStr = tmpArr[tmpArr.length-1];
trace("new file:SideBarAssets/"+tmpStr);
var destination:File = File.desktopDirectory;
destination = destination.resolvePath("SideBarAssets/"+tmpStr);
trace("destination:"+destination);
try
{
sourceFile.copyTo(destination, true);
trace("copied file");
}
catch (error:Error)
{
trace("Error:"+error.message)
}
}
this function should copy any file I pass to a folder on my desktop called "SideBarAssets".

but since I defined this in a function instead I get a folder called function Function () {} on my desktop and inside that I get another folder called SideBarAssets inside that I get another folder with the name of what the file should be for instance myfile.jpg and inside that folder I get a file named function Function () {}

very very strange

Adysone
03-03-2009, 05:20 PM
Hello,

I'v got the same problem, somebody can help us ?

Thank you :)

Adysone
03-11-2009, 02:31 PM
I found !

The code


Array.prototype.in_array = function (needle) {
// ...
}


was the problem.

I replaced it by


function in_array(needle,array) {
// ...
}


I hope it helps you ;)

Good luck !