Advanced Collision - Help Needed

Hi,

I’ve followed the Advanced Collision tutorial on this site but am having a few problems.

I’ve created the required MovieClips within one another:

Spaceship_mc; contains Perim; which contains lots of PerimBlock_mc 's (positioned around the perimeter of the Spaceship_mc shape)

The code I’m using is:

for (i in this.perim) {
     this.perim.localToGlobal(p={x:this.perim*._x,y:this.perim*._y});
     if(_root.bg_mc.cave_mc.hitTest(p.x, p.y, true)) {
          this._alpha=50
     }else{
          this._alpha=100
     }
}

The problem is that the collision is only detected for 1 of the Blocks around the Spaceship’s perimeter.

Could someone help with the code, I assume the loop isn’t working correctly (also not sure what the ‘i’ is really, should this be declared as a variable, or increased after each loop?)

Thanks in advance.