• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Flash CS6 AIR device emulator throws deactivate events when sensors change

Community Beginner ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

I am developing an app in Flash CS6 targeting AIR 21.0.0.176 for Android.  I have set up listeners for NativeApplication.nativeApplication Event.ACTIVATE and Event.DEACTIVATE.  These work as expected when the Android device is running standalone or if I am debugging via the USB interface to CS6. However if I deploy to the local simulator, then whenever I use the simulator interface to generate a change in accelerometer or geolocation, the app receives a DEACTIVATE event.

This makes troubleshooting difficult because on my DEACTIVATE event handler I by stop all interactive functions in the app.

Any ideas please?

TOPICS
Development

Views

358

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
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 17, 2016 Apr 17, 2016

I guess both ways work with the listener setup. It's not a bug though, the Simulator window is a different application, when you select it you have deactivated your app, it's doing the right thing. But in this case you don't want it to do the right thing, so use the work around.

Votes

Translate

Translate
LEGEND ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

There are various ways to tell if you're running on desktop or not, you can use that to know not to set the activation listeners. I do things like this:

if (Capabilities.version.indexOf('MAC') < 0) {

  stage.addEventListener(Event.ACTIVATE, fl_Activate);

  stage.addEventListener(Event.DEACTIVATE, fl_Deactivate);

}

You could also leave the listeners in and ignore them if you're testing on desktop.

Votes

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
community guidelines
Community Beginner ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

Thanks Colin.  Is this a known bug in CS6?

Or maybe I am not setting up the listeners the best way?  I am doing this:

NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, handleActivate, false, 0, true);

NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, handleDeactivate, false, 0, true);

Votes

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
community guidelines
LEGEND ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

I guess both ways work with the listener setup. It's not a bug though, the Simulator window is a different application, when you select it you have deactivated your app, it's doing the right thing. But in this case you don't want it to do the right thing, so use the work around.

Votes

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
community guidelines
Community Beginner ,
Apr 17, 2016 Apr 17, 2016

Copy link to clipboard

Copied

LATEST

I can certainly do the workaround and appreciate the suggestion.

I do understand your point about why the app is getting the deactivate events. In fact the behavior seems to be that whenever you take focus away from the open CS6 player running the app, even to the main CS6 app itself or the sim controller, it throws a deactivate event.  But it seems to me CS6 ought to be smart enough to know that if you are developing an app you don't want to deactivate it by clicking on the simulator controls! That's not simulating the device's actual behavior.  Meets the definition of a bug, in my opinion - an unexpected behavior that causes incorrect operation.

But again, thanks for explaining what's going on!

Votes

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
community guidelines