I am trying to check wich layers are turned on by the customers,
But when i use the AppEvent.LAYER_LOADED it only calls the function when i start the viewer, but not after i turn some layers on or off.
Here's my code:
AppEvent.addListener(AppEvent.LAYER_LOADED, listenHandler);
if (event.type == AppEvent.LAYER_LOADED)
{
trace("event type is layerLoaded");
if(logLayers)
{
trace("werkt hoor!");
}
} trace("event type is "+ event.type);
And at the startup i get this back:
event type is layerLoaded
werkt hoor!
event type is layerLoaded
event type is layerLoaded
werkt hoor!
event type is layerLoaded
But i get nothing back when i am using the viewer. and turn layers on or off..
Is this the way of doing it? or is there another way of checking when a layer is turned on or off?
Maybe with an addEventListener on map.getLayer("").visible = true of something?
Any help would be appreciated,
Thanks in advance
But when i use the AppEvent.LAYER_LOADED it only calls the function when i start the viewer, but not after i turn some layers on or off.
Here's my code:
AppEvent.addListener(AppEvent.LAYER_LOADED, listenHandler);
if (event.type == AppEvent.LAYER_LOADED)
{
trace("event type is layerLoaded");
if(logLayers)
{
trace("werkt hoor!");
}
} trace("event type is "+ event.type);
And at the startup i get this back:
event type is layerLoaded
werkt hoor!
event type is layerLoaded
event type is layerLoaded
werkt hoor!
event type is layerLoaded
But i get nothing back when i am using the viewer. and turn layers on or off..
Is this the way of doing it? or is there another way of checking when a layer is turned on or off?
Maybe with an addEventListener on map.getLayer("").visible = true of something?
Any help would be appreciated,
Thanks in advance