Flash Instance Names - spot the error
Say we have a simple flash file with an instance of a symbol on the stage (like a rectangle). The rectangle has an instance name and we want to change or display it's properties via action script.
Here's a screen shot of the stage and the instance properties.
And here's the code in the actions layer:
2trace(mcRect._x);
The output of the code is:
HUH? Shouldn't that be the x coordinate of the mcRect instance?
The issue is that there is an error in the instance name. Can you see what it is? Nope didn't think so.
The issue is there's a space at the end of the instance name it's actually "mcRect " not "mcRect" ie "mcRect
How would you find this out if someone gave you the file?
This code might give you a clue to what was going on.
2 trace(":"+item+":");
3}
But you'd still need to some some inkling to what the issue was.
Action script variables names can't contain spaces (esp at the end) so I've no idea why flash would let you type a space into the instance name field.
Hopefully you'll never run into this sort of error.