Groups | Blog | Home
all groups > flash actionscript > february 2004 >

flash actionscript : return not working...i think


N[e]RD
2/4/2004 10:29:26 PM
my code is attached below and is saved in an outside .as file. When I call decrypt() in my main movie and try to save the value returned by decrypt //Which should be char, right? aparantly when I call that variable later it is undefined. Am I calling return wrong or what? By the way when I trace(char) in the function it spits out the values I want it to everytime...so I am thinking that my problem lies within the return call. But perhaps I am wrong.

function decrypt(s:String) {
file = new XML();
file.ignoreWhite=true
file.load(s);
file.onLoad = function(success) {
array_String = file.toString().split(".");
char= "";
for (var i = 1; i<=array_String.length; i++) {
char = char+String.fromCharCode(array_String);
}
trace(char);
};
return char;
}

N[e]RD
2/6/2004 6:49:03 PM
CAN I PLEASE GET SOME HELP HERE?

N[e]RD
2/12/2004 3:40:58 AM
Jeckyl
2/12/2004 2:56:13 PM
You misunderstand returns from functions.

call you function like this

x = decrypt(s);

then x has the return value of the function. don't use the names of
variables you used inside the function itself

AddThis Social Bookmark Button