This content has been marked as final. Show 4 replies
Use an array to track all targets. Loop the array in checkPlace() to see which is hit.
A bit further
Your might use a generic Object or a class to define each entry in the array. As such you can know the target mc and an identifier as to the state and action to take for that array entry.
Thanks..sounds like i am on the right track: 2 questions...would such a looping array slow things down. And, is there a method that looks at the objects class? For example, onRelease would have a function that looks to see if the object "below" is a MovieClip, TextField, etc....much like you can use getDepth() to know an objects depth...is there an equivalent to getClass()???
I guess the size of the array is the issue. You can easily performance test that against the total number you expect without developing the entire code or even using the code above.
As I hinted, when you push onto the array, push an Object variable (or a custom class). One propery of the class would include the reference to the MovieClip or TextField. Then you can have another property identifying its type if you like and more properties and methods that determine what ever.
You might create a loop for each class of object as in the attached code.
A step above a generic Object is to create a class to define your objects and link to the class to a MovieClip symbol. Then you instantiate those and their instance variable is all you need to push to the array. A more sophisticate OO model might include an interface to define the similarities of the targets and then you build each type of a target as a MovieClip and link the appropriate class.
thanks mm...i am on the right track now, and the Bike Class is now detecting hooks, and there specific properties....time to get to work