Move InfoWindow when graphic moves (3.0)

2199
0
06-21-2012 08:06 AM
ChristopherDillard
New Contributor
Short version: What's the best way to handle InfoWindows for Graphics that move and change over time?  What would be the least surprising to the user, and how would I accomplish that in the code?

Longer story:

I have a custom GraphicsLayer in my Flex map application, and it's based on (a slightly-modified version of) the stock Flex Viewer, version 3.0.  Periodically a timer fires, my layer loads new data from the server, and existing Graphics in the layer are modified (attribute values and location).  This mostly works fine.  The graphics move around on the map over time, and the InfoWindows show correct popups.

But if there's an InfoWindow showing as its Graphic is being changed, you get odd behavior:

  • If the Graphic's attributes change, the data shown in the InfoWindow remains the same.

  • If the Graphic's position changes, a "ghost" Graphic remains at its original location until the pop-up is closed.  Also, the callout anchor doesn't move to follow the Graphic.

Instead, I think I'd prefer this:

  • When a Graphic's attributes change, the InfoWindow is updated accordingly.  (This is not hard, and I've managed it already.)

  • When a Graphic moves, the highlight graphic moves.

  • When a Graphic moves, the anchor of the InfoWindow moves to follow its center.

Those last two desired behaviors seem harder to work out.  Any suggestions?

Thanks!
Chris

p.s. If code could simulate a mouse click on the map somehow, then I could just fake-click on the shown-Graphic's new location to popup the new window at the new location.  But my handful of attempts with dispatchEvent(...) failed.  Maybe someone else reading this has had some luck with it and could suggest how to do it.
Tags (2)
0 Kudos
0 Replies