Dear diary,
okay- so I was really just wondering, if there is something like setting default values for a “tailor made” function that accepts variables? I mean- PHP offers the
function mycoolphpfunction ($myvar = "my default value") {
return $myvar;
}
…in case you’re not familiar with PHP: if no value is given to “mycoolphpfunction”, it just returns (in this case) “my default value”.
Does Actionscript have something similar? I didn’t find any reference to it so I’m just using…[AS]function mycoolasfunction (myvar) {
if ((myvar == undefined) || (myvar == “”)) {
myvar = “my default value”;
}
}[/AS]…to achieve the same effect.
Any way how I could save myself some time in any way? I guess instead of the “((myvar == undefined) || (myvar == “”))”-check, I could just write another function that checks a value / variable- if it is filled, it returns the value it’s filled with, if it isn’t filled, it returns the second value. I’ll experiemnt on that
Thanks in advance- and for your time reading this!
~Me