Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
Pea #1
hitTest coordinates
Hi there,
I have a problem wit ha complex call to 'hitTest' to test a point collision.
Which coordinates does the clip.hitTest(x,y) use? Are they rel;ative to the
'center' of 'clip' ?
I have a several nested clips. I have a 'track' which has a hit area clip for
the grass:
_root.track.grass
I also have a car on the track, and a clip on the car to use as the 'collision
point':
_root.track.car.coll_point
I get the hitTest coordinates for the 'grass' clip like this (from object
'Car'):
p = new Object();
p.x = coll_point._x;
p.y = coll_point._y;
this.localToGlobal(p);
_root.track.grass.globalToLocal(p);
_root.track.grass.hitTest(p.x, p.y);
However, this doesn't provide the correct coordinates for the hit test, even
though the point 'p' within 'grass' is correct. I know it is correct because I
can place a clip at that point and see that its in the correct place:
mark = _root.track.grass.attachMovie('marker','aMarker',2 00);
mark._x = p.x;
mark._y = p.y
This shows that the point 'p' on the 'grass' track is correct!
If it helps, the 'track' clip is moved all over the stage to keep the 'car'
clip in the center...
Any ideas as to why this doesn't work?
Cheers,
Pea
Pea Guest
-
Convert user space coordinates to device coordinates
Hi, I need to convert the coordinates of a word (PDWord object) to device coordinates (the actual coordinates on the screen). Could someone please... -
hitTest
Hello, my name is alex, and i am sort of a "Newbie" at action script, and i was trying to creat a hit test, so that when the "Axe" hits the guys... -
hitTest()
I have a MovieClip with one transparent bitmap inside. When I do hitTest(x, y, true) on an instance of that clip, the bitmap's square area is... -
hitTest with true
I'd like to create a hitTest betweeen two irregularly shaped mc's - To use the actusl pixels rasther than a bounding bov I need to put True as a... -
hittest: nested MCs
I have multiple dynamically duplicated objects, called "units". Let's say I have 2 at the point this code is executed: ... -
Pea #2
Re: hitTest coordinates
Hi all,
I should have taken my own advice for a post I just did and RTFM myself....
For any interested, the hitTest coordinates are in 'global' space (using
localToGlobal) and says so clearly in the help.
Cheers,
Pea
Pea Guest



Reply With Quote

