Groups | Blog | Home
all groups > flash actionscript > november 2004 >

flash actionscript : Would this be a hittest?


Anthony Brown
11/2/2004 10:58:15 PM
Hi I am developing a swf using the drawing API.

I basically will allow my client to draw lines on the U.S. map for Route
information pertaning to his business. To do this, I am "recording" the
mouse X,Y positons using OnMouse Down and OnMouse Up events. That works
great.

I have a legend on the map with his "route colors" Route1 = red, route2 =
yellow etc....

He is able to click on these colors and draw his lines on the map
accordingly with the color he clicked.

Problem:

Because I assigned the above Mouse events, when he picks a color on the
legend. Flash thinks he drew a line so, everytime he changes colors I get
data back when he clicked the color.

I don't want that to happen.
So, should I perform a "hittest" on my legend and somehow (which is the
other half of question) tell flash not to "draw" a line.

Here's my test URL.
Click,drag,release anywhere on the map to see the line. "save changes" and
you will see the data I am playing with.
http://flyingbarm.kermy.com/admin/flash/US%20map_content.html

Thanks

kglad
11/3/2004 7:19:30 AM
Anthony Brown
11/3/2004 8:54:32 AM
Sure enough that did it.
A simple hitest on the map instance and if statement as was suggested worked
like a charm.

Thanks guys!
My brain was fried lastnight when I asked.

[quoted text, click to view]

David Stiller
11/3/2004 9:27:53 AM
Jon,

Not so. As kglad points out, the MovieClip.hitTest() method accepts
either another movie clip as a target or x/y coordinates. The easiest
solution here is the one kglad points out. Could be handled with hitTest()
and a simple if() statement.


David
stiller ( at ) quip ( dot ) net

Jon Moyles
11/3/2004 3:24:55 PM
its only a hitTest if one movieclip is being dropped on another

so you could lock a mc to the mouse position to use that. but its prob
not the way you want to go.

test the mouse position in an if statement for your drawing code. or put
Jon Moyles
11/4/2004 8:59:16 AM
kglad
11/4/2004 2:42:23 PM
AddThis Social Bookmark Button