Closed GoogleCodeExporter closed 8 years ago
Yeah, it was just something small you were missing. The main issue you were
having
was properly scoping your variables.
Both your messageBox and collisionGroup variables were being cast as Arrays on
the
class level (messageBox is a TextField, and collisionGroup is the class
CollisionGroup). Properly casting them fixes part of the problem.
The next issue was that you were declaring collisionGroup inside the
constructor as
a local variable (though doing it as CollisionGroup this time). Here's how the
compiler sees all of that:
- I have a variable called collisionGroup that's accessible throughout the
class.
It's an array.
- I have a variable called collisionGroup that's a CollisionGroup. It's only
accessible in the constructor.
So when you run checkCollisions() in your mouse event handler, the only
collisionGroup varaible it sees is the empty array you declared at the top.
And
since checkCollisions() is not a method of Array, you received that error.
Here's an updated version of your file with the necessary corrections. Runs
great
now! :)
Original comment by lessthan...@gmail.com
on 20 Mar 2009 at 2:32
Attachments:
Ahhh yeah, very good explanation, thank you! I knew it was those 2
declarations,
took a guess with the array...
Thanks for the great code, works perfecty now!
Original comment by p...@pkhome.us
on 20 Mar 2009 at 7:47
Original issue reported on code.google.com by
p...@pkhome.us
on 20 Mar 2009 at 6:20Attachments: