I have a customized InfoWindow which shows data for all visible layers in a nice tree structure such that each visible service has its own branch in the tree and each layer in that service has a leaf under that branch. What I'd like to do is have the color of those layer leaf icons match the corresponding visible layers at the clicked point. I've been going about this by drawing the layer itself to a BitmapData object and grabbing a pixel from the location matching the users click on the map - then using that pixel to color the tree icon.
This seems to work fine as long as the map position remains unchanged, which is to say once I start panning/zooming I run into problems. Namely - when drawing the layers to a bitmap object after a pan I can't see anything from parts of the map that were not in the view when it initially loaded, the newly visible areas just show up as white space.
I've tried performing a validateNow() on everything from the layer itself to the entire map. I've also tried invoking refresh() on the layer before drawing it with no luck.
Any ideas? I'm also open to other suggestions for getting the color of a layer at a clicked point.