Ive got a flash game in AS3 which the aim of the game is to catch the students that fall asleep by simply clicking on them.
The problem i have is that in my Output window im getting
Quote:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ClassroomChaos_fla::MainTimeline/asleepHide()
|
The for loop below is my attempt at hiding all the objects in the
asleepArray array. I'll also upload my FLA for you to get a better understanding of what i'm trying to do...
Code:
function asleepHide(evt:Event):void {
for (var i:uint=0; i < asleepArray.length; i++) {
trace("im here i++")
asleepArray[i].visible=false;
trace("Asleep Students Hidden")
}
}
Another Problem im having is that the score starts at 1 instead of 0, and my score also increases everytime i click the mouse, not just when i click on a student.
Any help would be greatly appreciated.
Thank you all.
EDIT: Thanks for moving this
EDIT2: Ive found the problem with the for Loop....and it seems that the variable 'i' is not incrementing. I have coded it in another smaller file, and it works fine, so im guessing it is having a conflict with another part of my AS3 code.
This is really starting to annoy me