Select to view content in your preferred language

Stop code from running.

1587
4
Jump to solution
07-18-2014 11:09 AM
jaykapalczynski
Honored Contributor

I have 2 buttons in my application.  Identify and Buffer

What I ma after is clicking the identify and then being about to click the map and run it.

Then click the Buffer button and run the Buffer code.

Right now I can hit the Buffer Button and run the buffer code

Then click the identify button (click it) and run the identify code (THE BUFFER CODE DOES NOT RUN)

But if I go back to the Buffer Button and run that code the Identify code is STILL running.

I cant seem to pause the Identify code....Anyone have any thoughts

Just pasting a snip of the code below...can post more if need be.

  var action1, action2, action3;

  on(dojo.byId('Identify'), "click", Identify);

  on(dojo.byId('Buffer'), "click", Buffer);

  function Identify() {

  if (action2 != undefined) {

             action2.pause();

         }

         if (action1 == undefined) {

            action1 = initializeSidebar(app.map);

            action3 = mapReady();

            featureLayer.setInfoTemplate(template);

  }

         else {

             action1.resume();

         }

  

  }

  function Buffer() {

         if (action1 != undefined) {

             action1.pause();

             action1.destroy();

             action3.pause();

             action3.destroy();

         }

         if (action2 == undefined) {

              action2 = on.pausable(app.map, "click", function(evt) {

              var params = new BufferParameters();

              params.geometries  = [ evt.mapPoint ];

              params.distances = [ 2 ];

              params.outSpatialReference = app.map.spatialReference;

              params.unit = GeometryService.UNIT_STATUTE_MILE;

             BufferTool(map, params);  // Call BufferTool function and pass the Buffer Parameters

            });

         }

         else {

             action2.resume();

         }

  }

0 Kudos
1 Solution

Accepted Solutions
jaykapalczynski
Honored Contributor
0 Kudos
4 Replies
TimWitt2
MVP Alum

Jay,

In my application I use an identify listener combined with a check box.

Full Mapping Application - JSFiddle

It is the first couple lines of my code.

Lets hope that helps!

Tim

0 Kudos
jaykapalczynski
Honored Contributor

I have been bashing my head against the wall for over a week now....I cant get this to work....I trimmed it downthe best I could in the link below.

If oyu hit the first button on the right (identify) and click somewhere in Virginia it runs the code and returns results in a container on the right.  Promting a few alerts along the way,

The click the second button (Buffer).  When you click the map the prompts from the Identify still appear as well as the buffer alerts.  The buffer code runs fine, BUT the identify is also running forcing unneeded processing.

I have tried everything I could think of and Cannot get the identify to STOP running after one clicks the Buffer Button.

Can someone PLEASE put their eyes on this and maybe help me determine why I cannot shut off the Identify Code.

WEBSITE can be found here:  Application

0 Kudos
jaykapalczynski
Honored Contributor

this is posted in the wrong room...should be in JavaScript....moving now

0 Kudos
jaykapalczynski
Honored Contributor

Posted and Answered in this room

https://community.esri.com/message/389472#389472

0 Kudos