This content has been marked as final. Show 3 replies
there are several things here that you may want to do differently. First, I would place this code on the main timeline in frame1. Second, when using a shapeflag based hitTest method, you are comparing a single point, to a given MC instance, but the coordinates used must be within the same scope. So in the code above, you are comparing the _x position point of circle_mc and the yMax position point of circle_mc which would result in being a point at the lower left corner of the bounding box. If you are only trying to compare weather one shape's bounds comes in contact with another, then use the movieclip as a target.
So I would write this code as follows, on the first frame of the main timeline, with instances of 'circle_mc' and 'square_mc':
Sorry if this is important, but I neglected to mention that I am using Flash MX and only AS2, will this code still work, i am having trouble with the new keyboard controls.
yes this is AS2 code. In this example instead of using a series of IF statements, I consolidated them into a 'switch' statement. When a Key is press it check for the Key code, then compares it using the 'case' statements.
PS. after the last IF statment in the block, you should assign the current value of 'score' to the textField instance you have set up as in:
myScore_txt.text = score;