I had to do shape based collision detection like Grant Skinner describes here:
http://www.gskinner.com/blog/archive...8_shape_b.html
Try swf here:
http://img109.imageshack.us/my.php?image=test36cs.swf
My code here, mc with linkage name backmc is the background, mc back2 is the moving one and there is mc mouse inside back2 which will be dragged:
/*originally posted by tonypa,moved to its own thread by tomsamson*/Code:import flash.display.BitmapData; import flash.geom.ColorTransform; import flash.geom.Matrix; import flash.geom.Rectangle; this.attachMovie ("backmc", "backmc", 1); this.attachMovie ("back2", "backmc2", 2); backmc2.mouse.startDrag (true); this.onEnterFrame = function () { var myMatrix:Matrix = new Matrix (); var myCT:ColorTransform = new ColorTransform (0, 0, 0, 1, 0, 255, 255, 0); var myBmp:BitmapData = new BitmapData (400, 250, false); myBmp.draw (backmc, myMatrix, myCT, "normal"); myCT = new ColorTransform (0, 0, 0, 1, 255, 255, 255, 0); myBmp.draw (backmc2, myMatrix, myCT, "difference"); var cB:Rectangle = myBmp.getColorBoundsRect (0x00FFFFFF, 0x00FF0000, true); var collision:Boolean = true; if (cB.width == 0 and cB.height == 0) { collision = false; } _root.collision=collision; };




Reply With Quote