PDA

View Full Version : Map markers hit-test


Nugget89
01-11-2010, 03:51 PM
Hi,
I'm working on a project using google maps. I've set a number of points on the map and added markers to them. I have created a Sprite which the user can move around the map.
I am trying to make it so that when the sprite moves over one of the points a sound plays. I've tried using hittestobject but the markers do not seem to be able to interact with sprites.
Any suggestions as to how I can get this working?
Thanks,
Thomas

nikhiljoshi122
01-11-2010, 07:46 PM
Your markers must be display Objects
Put all your markers in a container
Now s soon as you drag your sprite use a mouseMove event handeller to loop through all the child's of the marker container to check for a hitTest between the sprite and your markers


Hope i got it right
If not hit me:)
nik

Nugget89
01-12-2010, 04:53 PM
Hi, thanks for the reply. I've tried putting the markers in containers but I'm getting an error 1067: Implicit coercion of a value of type com.google.maps.overlays:Marker to an unrelated type flash.displayDisplayObject.
I'm sure it's me doing something wrong as I'm new to this stuff, could you give me a quick idea of how you would go about this so I can see where I'm going wrong.

nikhiljoshi122
01-14-2010, 06:41 PM
can you show me some code hwre you are getting this error??

Nugget89
01-21-2010, 05:56 PM
I've tried a good few different attempts at this, but I've never used displayobjectcontainers before:

var container: DisplayObjectContainer = new DisplayObjectContainer();
container.addChild(marker1);

This was one of the attempts I made, gave me the error I posted earlier.