



So I’ve been trying to get my space alien game working, and ran into a huge block. No matter what I did, I couldn’t get Flash to recognize my lines with the hitTest function!
I couldn’t figure it out. I had two movieclips, and I was trying to use the hitTest function. What’s so hard about that???
You can test for yourself. First make a line on the stage, then make it into a movieclip with F8. Call it something original like “lineOnStage”. Now try as you can, you will never be able to get the hitTest to fire!!! Oh boy. Guess they forgot to mention that the hitTest function works with the fill, not the border.
createEmptyMovieClip("triangle_mc", getNextHighestDepth());
triangle_mc.beginFill(0x006090);
triangle_mc.moveTo(50, 50);
triangle_mc.lineTo(100, 150);
triangle_mc.lineTo(0, 150);
triangle_mc.lineTo(50, 50);
var hit_X = 100;
var hit_Y = 75;
var shapeFlag = true;
triangle_mc.onPress = function() {
this.startDrag();
};
triangle_mc.onRelease = function() {
this.stopDrag();
if (this.hitTest(lineOnStage)) {
trace("Hit.");
}
};
Ok, one more secret:
If you reduce the width of a rectangle to 1, you can never increase it again. It is now a line. Haha. So you have to delete it and start from scratch.








How do i chance the dynamic text in flash using html? – Yahoo! Answers.
My answer wins. Unfortunately there were no other answers, so I’m not sure if I even helped the person who asked the question. I also realize that the answer might be different in AS3.0 than AS2.0, but I won anyway. Applause!


More Options ...

Categories
Tag Cloud
Blog RSS
Comments RSS

Void
Life « Default
Earth
Wind
Water
Fire
Light 