Select to view content in your preferred language

Issues upgrading Flexviewer 3.1 (uncompiled)

8574
48
Jump to solution
12-18-2012 10:05 AM
by Anonymous User
Not applicable
Original User: btelliot

Hi All,

I've been upgrading our in-house web mapping application from flexviewer 3.0 to 3.1, and I've encountered a small problem.

The first time I load the Flexviewer application in the web browser, the User Interface doesn't load properly.  If I refresh using the F5 button, it loads properly.

Here is a screenshot of the issue:
First load:
[ATTACH=CONFIG]20039[/ATTACH]

After refresh (F5)
[ATTACH=CONFIG]20040[/ATTACH]

Any help on the matter would be appreciated.

Cheers,

Brett
0 Kudos
48 Replies
by Anonymous User
Not applicable
Original User: rzufelt

Was wondering if you can reproduce this consistantly, and if so, how?

Since I had not seen this yet, and have I popups on most of my data, figured I'd try to figure it out.

So, went back to the OTB fv and played around with the tiled/visible settings, etc.  For some reason, if I close the browser, then run the app, I will get that error about 1 out of 7 times.  real hard to troubleshoot what is "wrong" when it isn't consistant (almost as it was written by Microsoft :)).

Wondering if anyone has come up with a way to consistantly make it do this?

R_
0 Kudos
MattiasEkström
Frequent Contributor
Seems to happen for me on sublayer popups only and occurs in the getlayerinfos code in createChildren (TocMapLayerItem). When loading the toc the layer info returns a null which interrupts the widget loading process causing the UI to look a bit crazy.

I did some more testing, and this is true for me as well, the problem seems to be sublayer popups for dynamic layers. Popus for a feature layer or a sublayer to a tiled layer did not cause this problem. Using the debug version of FlashPlayer I'm getting
TypeError: Error #1009: Det går inte att få åtkomst till en egenskap eller metod för objektreferensen null.
 at widgets.TOC.toc.tocClasses::TocMapLayerItem/createChildren()
 at widgets.TOC.toc.tocClasses::TocMapLayerItem()
 at widgets.TOC.toc::TOC/registerMapLayer()
 at MethodInfo-626()
 at widgets.TOC.toc.utils::MapUtil$/forEachMapLayer()
 at widgets.TOC.toc::TOC/registerAllMapLayers()
 at widgets.TOC.toc::TOC/commitProperties()
 at mx.core::UIComponent/validateProperties()
 at mx.managers::LayoutManager/validateProperties()
 at mx.managers::LayoutManager/doPhasedInstantiation()
 at mx.managers::LayoutManager/doPhasedInstantiationCallback()

And it seems that's were the code breaks down and the rest of the UI and widgets are not loaded.

Unfortunately I haven't been able to reproduce this using only public services from Esri, it's when I change to my own mapservices this happens (and they are not public). But as mentioned many times before in this thread, there were no problems with 3.0 using the same services and popups.

Wondering if anyone has come up with a way to consistantly make it do this?

Maybe this isn't what you ment but in an earlier version I added timestamps to URLs to prevent browsers to read any config-files from cache. When adding this to my 3.1 viewer I'm getting the same problem everytime, even after refreshing the site, which is kind of obvious since the problem comes after clearing the cache and now the browser doesn't read from cache.
The timestamp for popus I added to Mapmanager.mxml in the function "configurePopUps"
//var popUpConfigURL:String = arrLayerPopUp.popUpConfig;
 var popUpConfigURL:String = String(arrLayerPopUp.popUpConfig) + "?ts=" + new Date().getTime();)


We are many users experience this problem, this thread http://forums.arcgis.com/threads/76137-Header-widget-display-issue-when-upgrading-to-3.1 is about the same problem. I hope the ESRI Flex Team could take a closer look at this...
0 Kudos
by Anonymous User
Not applicable
Original User: rscheitlin

Mattias,

   The code you have in the error is coming from my TOCWidget so I would remove it and see if your problem clears up.
0 Kudos
MattiasEkström
Frequent Contributor
Yes, Robert, you're correct, I copied the error message from the wrong version, one were I've made some more customization.
This is what I get from to original viewer (after only changing config.xml yo use my own layers...):
TypeError: Error #1009: Det går inte att få åtkomst till en egenskap eller metod för objektreferensen null.
 at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem/createChildren()
 at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem()
 at com.esri.viewer.components.toc::TOC/registerMapLayer()
 at MethodInfo-386()
 at com.esri.viewer.components.toc.utils::MapUtil$/forEachMapLayer()
 at com.esri.viewer.components.toc::TOC/registerAllMapLayers()
 at com.esri.viewer.components.toc::TOC/commitProperties()
 at mx.core::UIComponent/validateProperties()
 at mx.managers::LayoutManager/validateProperties()
 at mx.managers::LayoutManager/doPhasedInstantiation()
 at mx.managers::LayoutManager/doPhasedInstantiationCallback()

That's from the standard toc component so it doesn't have anything to do with Roberts TOC Widget.


EDIT: I've also opened an issue on github for this issue.
0 Kudos
by Anonymous User
Not applicable
Original User: rzufelt

Maybe this isn't what you ment but in an earlier version I added timestamps to URLs to prevent browsers to read any config-files from cache. When adding this to my 3.1 viewer I'm getting the same problem everytime, even after refreshing the site, which is kind of obvious since the problem comes after clearing the cache and now the browser doesn't read from cache.
The timestamp for popus I added to Mapmanager.mxml in the function "configurePopUps"
//var popUpConfigURL:String = arrLayerPopUp.popUpConfig;
 var popUpConfigURL:String = String(arrLayerPopUp.popUpConfig) + "?ts=" + new Date().getTime();)


We are many users experience this problem, this thread http://forums.arcgis.com/threads/76137-Header-widget-display-issue-when-upgrading-to-3.1 is about the same problem. I hope the ESRI Flex Team could take a closer look at this...


Odd, even with this change, it seems to only happen about 1 in 10 times that I open my FV.  Maybe one it 7 or 8 if I open with the debug button (seems more frequent).

Of course, this is only with ESRI data.  I have NOT been able to reproduce it at all with my own services (in a different WKID).

Today I noticed that I seem to get the error at about the same frequency that i get the sandbox violation from server.arcgisonline.com and services.arcgisonline.com (http://forums.arcgis.com/threads/71383-map-service-delay-on-open).  Maybe it is related??????

R_
0 Kudos
MattiasEkström
Frequent Contributor
It seems like I got rid of this problem by commenting out the line (368):
arcGISDynamicMapServiceLayer.visibleLayers.addEventListener(CollectionEvent.COLLECTION_CHANGE, visibleLayersChangeHandler);
in com/esri/viewer/components/toc/tocClasses/TocMapLayerItem.as
Obviously not a good solution when I'm loosing some other functionality, but it points out which line of code that cause the problem, that code is also new in 3.1. which makes sense...

Maybe some more users using the source code could try this to see if it works for others than me.
0 Kudos
by Anonymous User
Not applicable
Original User: rscheitlin

Mattias,

   It has to be that the visibleLayers is null then. Try this bock of code (replacing the similar block) ***This code is untested, Just theory based on error***

            var visLayers:Array = [];
            var arcGISDynamicMapServiceLayer:ArcGISDynamicMapServiceLayer = ArcGISDynamicMapServiceLayer(layer);
            _dynamicMapServiceLayerInfos = arcGISDynamicMapServiceLayer.dynamicLayerInfos ? arcGISDynamicMapServiceLayer.dynamicLayerInfos : arcGISDynamicMapServiceLayer.layerInfos;
            if(arcGISDynamicMapServiceLayer.visibleLayers){
                arcGISDynamicMapServiceLayer.visibleLayers.addEventListener(CollectionEvent.COLLECTION_CHANGE, visibleLayersChangeHandler);
            }else{
                visLayers = getActualVisibleLayers(MapServiceUtil.getVisibleSubLayers(_dynamicMapServiceLayerInfos), _dynamicMapServiceLayerInfos);
                ArcGISDynamicMapServiceLayer(layer).visibleLayers = new ArrayCollection(visLayers);
                ArcGISDynamicMapServiceLayer(layer).visibleLayers.addEventListener(CollectionEvent.COLLECTION_CHANGE, visibleLayersChangeHandler);
            }
            _visibleLayersChangeWatcher = ChangeWatcher.watch(arcGISDynamicMapServiceLayer, "visibleLayers", visibleLayersChange);
0 Kudos
MattiasEkström
Frequent Contributor
Thanks Robert!
That code is working for me.
At least I'm not getting the problem as when I commented out the line, but I never figured out what exactly that line did so I don't know if that works now or not. But I guess it does.
0 Kudos
by Anonymous User
Not applicable
Original User: rscheitlin

Mattias,

   My theory is that the arcGISDynamicMapServiceLayer.visibleLayers is null at times. This property was always populated in previous versions of the API but in 3.1 it is initially null so the line for adding an collection cahnge event handler to a null object is the issue. The code I added ensures that if it is null then it will populate the visibleLayers list with the default visible layers of that map service.
0 Kudos
HessCorporation
Emerging Contributor
I've been able to re-produce this problem fairly consistently, the more sublayer popups you have configured against a single service the more likely it is to occur, i have a service with 60 sublayers each with their own popupconfig and it occurs every time.

My theory is along the same line as those above, i think that the get layer details request is taking longer due to the size of the service and the toc is trying to set itself before the visiblelayers property is set, hence why it returns the null. This also may be why some experience the problem intermittently because the request time will vary with network traffic and also whether flash player has cached the application or not, if i flush the FP cache the error is always triggered, refreshing the browser often won't as the app is loading faster from the cache.

I used the same workaround as Robert by just adding...
if (arcGISDynamicMapServiceLayer.visibleLayers)

That fixes the error but i'm still trying to work out what functionality is potentially lost as a result, my general feeling is that since the error doesn't happen very often it won't be too noticeable by the users.
0 Kudos