Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 166
Registered: ‎03-04-2011
My Device: Playbook

Responding to deactivation and antivation.

Hello.

 

I'm very very new on Playbook development. I'm developing an ActionScript 3.0 application.

 

Reading Blackberry Tablet OS SDK for Adobe Air Development Guide I've found that I have to respond to deactivation and antivation.

 

Now, I have three AS3 source files, one for program (I think) and two for two pages. You can find my code here Two windows app question.

 

On which source file I have to respond to those events?

 

Thanks.

Developer
Posts: 386
Registered: ‎12-12-2010
My Device: BB Style

Re: Responding to deactivation and antivation.

Don't think its  mandatory. But handling those events can help in situations where you want to take special actions when the user minimizes the app or scrolls to a different app.

Developer
Posts: 166
Registered: ‎03-04-2011
My Device: Playbook

Re: Responding to deactivation and antivation.

But my question is on which source file I have to respond to those events?

Developer
Posts: 386
Registered: ‎12-12-2010
My Device: BB Style

Re: Responding to deactivation and antivation.

Sorry for some reason I misunderstood your qn on my first read. After reading it the second time, my thoughts are that you can add the EventListeners in any of the files. It depends on the App. You can also add multiple listeners in different classes each one will get triggered when the event occurs. you may want to act on some data that is private to some class..in that case adding an event listener in that class may be needed.

 I guess you could also have a single handler and invoke functions and pass data between classes.

New Developer
Posts: 56
Registered: ‎02-07-2011
My Device: BB Playbook

Re: Responding to deactivation and antivation.

Hi,

 

As mentioned by tags07, this is entirely up to you. My suggestion is to keep the activate/deactivate listeners on the main entry point class, as your whole app has to react to these events, so you can set consumption rate and frame rate lower and save any other requirement.

 

Thanks, 

-------------------------------------
www.danielwind.net

Playbook App:
Grab Da Crab
Developer
Posts: 166
Registered: ‎03-04-2011
My Device: Playbook

Re: Responding to deactivation and antivation.

And, How can I save my state, using SharedObjects?

 

If I have instanced two classes, when restoring app state, I must create two new instances?

 

New Developer
Posts: 56
Registered: ‎02-07-2011
My Device: BB Playbook

Re: Responding to deactivation and antivation.

Hi VansFannel,

 

You have several options for saving states. Effectively you can use SharedObject or SQLite embedded database. This all depends on the type of application that you are planning to offer.

 

In the instantiation case, if you destroy them from memory (nullifying it and removing all references to it) and the garbage collector has already removed it, then you must create a new object. Please be aware that Adobe AIR on mobile good practices encourage you to use object pooling instead of creating new objects all the time (in case you have many objects of course).

 

For further reference:

http://help.adobe.com/en_US/as3/mobile/WS948100b6829bd5a6-19cd3c2412513c24bce-8000.html

 

Hope this helps.

 

 

-------------------------------------
www.danielwind.net

Playbook App:
Grab Da Crab
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Responding to deactivation and antivation.

You can also save the information in a XML file.  As @daniel_wind mentioned, it all depends on the data and how it will be used.