actionscript help
- Started
- Last post
- 3 Responses
- flippers
i've been stuck on this one for hours now and its driving me nuts, it seems so simple. I have a movieclip called 'ball' and a movieclip called 'targetClip', they are both nested within a main movieclip. i need to do a hit test to see if ball is inside targetClip, but i need to have the shapeflag set to true as targetClip is an iregular shape. i just can't get it to work?
i'm trying this but it's just saying "miss" all the time:
onClipEvent(load){
startDrag(this, true);
}
onClipEvent(enterFrame){
if(_parent.targetClip.hitTest(_x...
trace("hit");
}else{
trace("miss");
}
}any ideas?
- nuggler0
When you're in a function you should use this._x and this._y, otherwise it's not sure what you mean by x and y. Then it should work
- caseyc0
This is kinda hackish but works:
http://actionscript-toolbox.com/…
You basically have to put a bunch of "perimiter" mcs on the edges of your irregular shaped object and hitTest against those.
- imakedesign0
try using hitArea instead of hit test:
square_mc.hitArea = circle_mc;
square_mc.onRelease = function() {
trace("hit! "+this._name);
};