AS3 Error #1009
AS3 Error #1009
- Started
- Last post
- 3 Responses
- CyBrain0
Uh... nevermind, I was exactly right about this being wrong 10% of the time. When I used the line
pressBtn_array[Math.floor(Math.r... * pressBtnTotal)].y += 5;floor was creating an index result of 0 and my for loop went from 1 to 10. I initialized the array with null as the zeroeth entry — hence the "null object reference".
- Autokern0
Yep exactly.
When navigating/populating you array do this:
for (var i:uint = 0; i < pressBtnTotal; i++)
So you'll populate the thing starting from 0 which will give you less headaches- In general, keeping things zero-based will make life simpler.acrossthesea