I threw together a fla to spike some code. At some point, it's lost it's fidelity. It was telling me I couldn't debug the file because it didn't contain AS3. It did.
Then, I found that there was an extra dot in my code, which was not caught during auto-format or syntax checking. I removed the extra dot, and then I started to notice bugs. I got runtime errors that a var was 21, when it is clearly set to 22. I also changed the datatype of a Vector to an Array and all of a sudden the compiler acts as if the array doesn't exist.
Like I said, I was just spiking some code, and could have made some errors in there somewhere, but this is getting out of hand.
[Update: I can't upload an FLA to the official Flash support site. That's about par for the course guys.]
There are many, many, things wrong with your code.
1. You named your desk objects desk_1 through desk_22, and then in your for loop, you only add the first 21 of them. While your naming starts with _1, an array in Actionscript starts counting at 0. So your for loop should have been:
for(var i:int = 1; i <= studentDeskNum; i++)
2. This if condition, if(i == studentDeskNum) is completely unnecessary.
3. You are calling the function, initMovableItems(); twice, once in the initRoom() function and again at the end of the pushMovableItems() function. The second is correct, as far as I can tell.
4. In the initMoveableItems() function you are iterating through 31 items and trying to set a scaleX and scaleY property value based values that are in an array, aScaleFactors. There are only 9 values in this array, and so the iteration fails after the last value is used.
There is probably much, much, more.
Hmm. I was copying/pasting between FLAs, so it would make sense some old code got mixed in with new. Doh. Sorry about that. I actually cleaned it up and fixed it while waiting for a response. Thanks.