Select to view content in your preferred language

Legend not showing in any broswer - Should I use a ObjectProxy?

2168
2
Jump to solution
04-17-2012 07:33 AM
ionarawilson1
Deactivated User
Hi guys,

I have a map application that cannot display the legend colors (the problem is just with the squares on the legend, the map is fine). I initially thought the problem was with Internet Explorer 8 but after testing in I.E 8 in my computer (it worked on my computer but not in any other computer) and using the debugging tool it seems that the problem is that the legend cannot refer to the dynamic layer as it is not able to determine the binding value. I tried to create a creationcomplete function to wrap the value in a ObjectProxy but that did not seem to help. Because the map appears according to the selected item in a combo box, the dynamic layer url is defined as "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/{myURL.selectedItem.value}/MapServer" and the value is the value determined in each service that is displayed as an array collection object in the myURL combobox.


[ATTACH=CONFIG]13593[/ATTACH]


So in debugging mode I get a warning

warning: unable to bind to property 'value' on class 'Object' (class is not an IEventDispatcher)

Because the legend is not able to detect the value for the selectedItem in the combobox, which is the value that will be used to get the right service in the dynamic layer.

I am attaching the original code I created and here is the creationComplete function I added before the loadlyaer function but it is not having effect:


private var legendLayers:Array = null;
[Bindable]
private var objectProxy:ObjectProxy;

private function creationCompleteHander():void
{


objectProxy = new ObjectProxy (myURL.selectedItem)
objectProxy.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, onPropertyChange)
objectProxy.value = "TFEI_07_forest_industry_output"


function onPropertyChange (event:PropertyChangeEvent): void

{
myURL.selectedItem.value = event.newValue.toString();


}
}


Can you please tell me what's wrong with the function? Should I create another function instead of a creationcomplete function? How do I make the legend read the right dynamiclayer, i.e how do I make it bindable ? What I dont understand is that the dynamiclayer seems to be bindable as the map appears so it is getting the right value on the service but the legend cant find the right service.

Any help is greatly appreciated! Thank you!
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Original User: ionara_wilson

The way I fixed the warning was creating an expression in the event function to direct to the right service depending on the selected index of the combo box:

if (myURL.selectedIndex == 0){
     dynamicLayer.url = "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/TFEI_07_forest_employment/MapServer"}

However the problem with the legend still persisted, so I went to the flash player security settings and added the folder I had the data and the problem was solved. So I think the legend problem appeared just because the website has not been published on the web yet. I hope it helps anybody with the same problem.

View solution in original post

0 Kudos
2 Replies
ionarawilson1
Deactivated User
I also tried to  make the expression bindable but it did not work

Like that

[Bindable]
private var myURLvalue:String = "myURL.selectedItem.value"

And then on the dynamicLayer

<esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" name=" "
                 url = "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/{myURLvalue}/MapServer"
                 alpha="1"
                 load="loadLayerName()  "
0 Kudos
by Anonymous User
Not applicable
Original User: ionara_wilson

The way I fixed the warning was creating an expression in the event function to direct to the right service depending on the selected index of the combo box:

if (myURL.selectedIndex == 0){
     dynamicLayer.url = "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/TFEI_07_forest_employment/MapServer"}

However the problem with the legend still persisted, so I went to the flash player security settings and added the folder I had the data and the problem was solved. So I think the legend problem appeared just because the website has not been published on the web yet. I hope it helps anybody with the same problem.
0 Kudos