flsg -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (6/29/2008 10:13:45)
|
^ yeah that works too lol but in AS3 I think it's hitTestObject for touching a MC, and hitTest for touching a point, and it's slightly diffrent. currently they classed hitTest not as a movieclip method anymore, but as a bitmapdata method >_< to hittest a point, you need to do like this: var bd:BitmapData = new BitmapData(80, 80);//create a bitmapdata object, defines its dimensions //hittest it with a point trace(bd.hitTest(new Point(1, 1), 0xFF, new Point(30,30)))//returns true where the first argument is a point object which defines the positions of the upper-left corner of that bitmapdata object you want to touch, the second argument is "The highest alpha channel value that is considered opaque for this hit test"(taken from the documentation), and the third is the second point you want to touch with the first object. Of course, I took the documentation's example, but in real coding you'll change the point object's values so that they correspond to the mc's x and y positions the above code returns true, since the bitmapdatat object, at (1,1), stretch until (81, 81), which touches (30,30) I think I just discouraged everyone here to learn AS3 ;_; I feel like talking to myself again... Nicky: forget what I said about the hypothenuse thing, I just didnt want everyone to abuse hittest lol. But if it's really easier to do do with hittest, do it XD also, if you think AS2 is easier, use mcName.hitTest(x,y,true) like somebody said.
|
|
|
|