Get your own customer support community
 

Whats wrong with this AS3 + Markers hack?

I'm using the AS3 code from Rev. 330 of the SVN trunk. I'm trying to hack in visible markers by adding "markr" buttons to the tile "well" sprite. (This makes panning look good.) For some reason the markers aren't responding to their mouse events. What's special about this "well" thats breaking mouse events (or what I'm doing wrong otherwise)?

Here's the relevant code:

// Grab an instance of the grid's "well"
var well:Sprite = Sprite(map.grid.getChildByName("well"));

// Create an event handler for marker clicks
function traceClick(event:MouseEvent):void{
trace("Real Target " + event.target + ":" + event.target.name);
trace("You clicked " + event.currentTarget + ":" + event.currentTarget.name);
trace("Bubbles? : " + event.bubbles);
}

// Create an event handler for map MarkerEvent.ENTER
function onMarkerEnters(ev:MarkerEvent):void {
var pointXY:Point = map.locationPoint( ev.location, well );
var mark:DisplayObject = well.addChild(new markr());
mark.name = ev.marker;
mark.x = pointXY.x;
mark.y = pointXY.y;
mark.addEventListener(MouseEvent.CLICK, traceClick);
}

map.addEventListener(MarkerEvent.ENTER, onMarkerEnters);
 
silly I’m a big dork
Inappropriate?
1 person has this question

User_default_medium