Highlighted

DEACTIVATE event fires on app load in OS X

New Here ,
Jun 18, 2014

Copy link to clipboard

Copied

When running AIR on OS X (tested with 13.0 on Mavericks), the DEACTIVATE event fires when the application first opens! But this doesn't happen on Windows.

So for example:

<html>

  <head>

  <title>Simple Test</title>

  </head>

  <body>

  <script src="AIRAliases.js"></script>

  <script>

  window.nativeWindow.addEventListener(air.Event.DEACTIVATE, function() {

  air.trace('DEACTIVATE');

  });

  </script>

  </body>

</html>

I will see that trace statement as soon as I run the application... Which is a huge issue as I have logic that I run on DEACTIVATE that I DON'T want to run on app load and in doing so causes a loop of functions 3-4 times... Again this DOES NOT HAPPEN on OS X.

Is this a bug? Or am I missing something about the way OS X handles windows?

Currently to get around this... I am having to do:

if (air.Capabilities.os.indexOf("Mac OS") > -1) {

   

    var firstRun = false;

   

    window.nativeWindow.addEventListener(air.Event.DEACTIVATE, function() {

  if(firstRun) {

  air.trace('DEACTIVATE');

  } else {

  firstRun = true;

  }

  });

   

} else {

  window.nativeWindow.addEventListener(air.Event.DEACTIVATE, function() {

  air.trace('DEACTIVATE');

  });

}

TOPICS
Development

Views

125

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

DEACTIVATE event fires on app load in OS X

New Here ,
Jun 18, 2014

Copy link to clipboard

Copied

When running AIR on OS X (tested with 13.0 on Mavericks), the DEACTIVATE event fires when the application first opens! But this doesn't happen on Windows.

So for example:

<html>

  <head>

  <title>Simple Test</title>

  </head>

  <body>

  <script src="AIRAliases.js"></script>

  <script>

  window.nativeWindow.addEventListener(air.Event.DEACTIVATE, function() {

  air.trace('DEACTIVATE');

  });

  </script>

  </body>

</html>

I will see that trace statement as soon as I run the application... Which is a huge issue as I have logic that I run on DEACTIVATE that I DON'T want to run on app load and in doing so causes a loop of functions 3-4 times... Again this DOES NOT HAPPEN on OS X.

Is this a bug? Or am I missing something about the way OS X handles windows?

Currently to get around this... I am having to do:

if (air.Capabilities.os.indexOf("Mac OS") > -1) {

   

    var firstRun = false;

   

    window.nativeWindow.addEventListener(air.Event.DEACTIVATE, function() {

  if(firstRun) {

  air.trace('DEACTIVATE');

  } else {

  firstRun = true;

  }

  });

   

} else {

  window.nativeWindow.addEventListener(air.Event.DEACTIVATE, function() {

  air.trace('DEACTIVATE');

  });

}

TOPICS
Development

Views

126

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 18, 2014 0

Have something to add?

Join the conversation