Select to view content in your preferred language

Random initialization issue

2667
3
11-22-2011 12:41 AM
LAHAYEYann
New Contributor
Hi,

I'm experiencing some strange behavior with the FlexViewer when the ViewerContainer is not directly instantiated at run-time : randomly, the initial extent specified in the main configuration file is not taken into account resulting in a wrong localization.

Steps to reproduce :
- In the "index.mxml" file, add the following lines :
 <s:states>
  <s:State name="button" />
  <s:State name="map" />
 </s:states>

 <s:Button includeIn="button" click="{currentState = 'map';}" />

- In the "index.mxml" file, add the following parameter to the ViewerContainer :
includeIn="map"

- Compile and run the application : The previous modification modify the application so that when it's run, first, a white page with a button will appear; a click on the button will enable the viewer container.
- Run several times the application to notice that sometimes, the initial extent is correct and sometimes not.

Is there a solution or a workaround ti this issue?

For more information, I'm using :
- Flex viewer 2.4 with agslib 2.4,
- Adobe Flex SDK 4.5.1.

I've also run my tests with SDK 4.1.

Sincerely yours,

Yann
Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
Yann,

   You are running into the same issue that the Login widget had. Look at the code changes that I made to the viewer to handle this. Ultimately it is a timing issue.

http://forums.arcgis.com/threads/25899-Login-Screen-for-the-Flexviewer?p=139178&viewfull=1#post13917...
0 Kudos
LAHAYEYann
New Contributor
Yann,

   You are running into the same issue that the Login widget had. Look at the code changes that I made to the viewer to handle this. Ultimately it is a timing issue.

http://forums.arcgis.com/threads/25899-Login-Screen-for-the-Flexviewer?p=139178&viewfull=1#post13917...


Thanks Robert,

It did the trick, I had in mind it was a timing issue (as the behavior was dependent on breakpoints...), but I could not figure out how to solve it.

Could you tell me how was the counter size chosen? I understand basically the concepts of the "callLater" function, but not enough to be able to optimize the counter.

Thanks again,

Yann
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Yann,

   The counter is just a way to delay the code execution. I just found what worked best in most situations.
0 Kudos