Select to view content in your preferred language

Viewer 3.1 - Zoom issues

2878
8
Jump to solution
01-31-2013 08:45 AM
AshleyPeters
Frequent Contributor
When the map first opens in the viewer, I have to click on the map before I can zoom. I can zoom as soon as the map opens in older editions in the viewer. Is there a setting I need to change somewhere to allow for a user to zoom without clicking on the map first?

Thanks in advance for your help!

Ashley
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RhettZufelt
MVP Notable Contributor
Easiest way is to use Google Chrome, as this is the default 🙂

Just making that change did not do it for IE8, I also had to modify the <s:Application tag> as such:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:viewer="com.esri.viewer.*"
               xmlns:managers="com.esri.viewer.managers.*"
               pageTitle="ArcGIS Viewer for Flex"
      creationComplete="init()">


Not sure if crationComplete is the right call to make there, but it is working.

R_

View solution in original post

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus
Ashley,

   That would involve adding this block to the index.mxml

    <fx:Script>
        <![CDATA[            
            protected function init():void
            {
                navigateToURL(new URLRequest("javascript: document.getElementById('index').focus();"), "_self");
            }
        ]]>
    </fx:Script>
0 Kudos
AshleyPeters
Frequent Contributor
Robert,

Thanks for the quick reply.

I tried adding that code into the index.mxml but it didn't resolve the issue.

Ashley
0 Kudos
RhettZufelt
MVP Notable Contributor
Easiest way is to use Google Chrome, as this is the default 🙂

Just making that change did not do it for IE8, I also had to modify the <s:Application tag> as such:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:viewer="com.esri.viewer.*"
               xmlns:managers="com.esri.viewer.managers.*"
               pageTitle="ArcGIS Viewer for Flex"
      creationComplete="init()">


Not sure if crationComplete is the right call to make there, but it is working.

R_
0 Kudos
AshleyPeters
Frequent Contributor
Rhett,

Adding that line of code with the code Robert provided worked. Thanks!

Ashley
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ashley,

   Rhett is absolutely right I forgot to add that to my original post.
0 Kudos
RhettZufelt
MVP Notable Contributor
Rhett,

Adding that line of code with the code Robert provided worked. Thanks!

Ashley


I just added the part that he forgot to.  He would have got there once he realized it.

However, Robert is really the one that answered this question, and should get the check mark.  Besides, I'm not in the running for MVP anyway, so would be a wasted check mark on me.

R_
0 Kudos
RhettZufelt
MVP Notable Contributor
Robert,

the creationComplete="init()" works just fine, but I see that so does initialize="init()". (initialize "looks" more correct in this case)

At first wasn't sure what to use as normally I see creationComplete in like a widget or something that actually gets "created", but it worked.

However, curious if there is a "more correct" method, or does it not really matter how you call the init() function?

R_
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhett,

   I have always used CreationComplete for this as I don't believe that it matters (in this case) if the javascript getts called before all the children of the index.mxml get created or after (which is where CreationComplete is called).
0 Kudos