I’m passing an array as an argument to a class, like this:
formatArray = [string, number, number,
string, number, number,
string, number, number,
string, number, number,
string, number, number];
The class, which converts the array to _formatMatrix, is is set up to EXPECT the array to contain 15 elements. In the class, I do this:
switch (_formatMatrix[12]) {
// do something
}
When I pass formatArray containing only four sets of <string, number, number> rather than five, I get this error:
Error #2007: Parameter format must be non-null.
I have tried adding a conditional to the class that makes it disregard the fifth set thus:
if (_formatMatrix[12] = null) {
trace("_formatMatrix[12] is undefined!");
} else {
// do something
}
This doesn’t work – I still get the 2007 error, and I don’t see the trace. Meaning, I never get to the conditional because Flash doesn’t like that I have not included the fifth set. I have also tried…
if (_formatMatrix[12] = undefined)
…but that doesn’t work and I don’t actually know if that’s valid.
What do I need to do to make the class allow me to pass an “incomplete” array?
Thanks!