I am trying to create collision detection between mcs without having to write the code 10 times.
I thought this would work but it gives me this error:
TypeError: Error #1034: Type Coercion failed: cannot convert “crisisAnimation” to flash.display.MovieClip.
at ImagineServicesText2_fla::MainTimeline/hitTester()
var target_mc:Array = new Array();
var numTextBoxes:Number;
target_mc = ["crisisAnimation","eventTextAnimation","mediaRelationsAnimation", "mediaAnimation", "graphicAnimation", "webAnimation", "advertisingAnimation"];
//
function hitTester(event:Event):void {
numTextBoxes = target_mc.length;
for (var i:int =0; i<numTextBoxes; i++) {
var textA:MovieClip = target_mc*};
for (var j:int =i+1; j<numTextBoxes; j++) {
var textB:MovieClip = target_mc[j]};
//temp_A = eval(textA);
//temp_B = eval(textB);
if (textA.hitTestObject(textB)) {
trace ("Hit!");
}
}
this.addEventListener (Event.ENTER_FRAME, hitTester);