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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 49
Registered: ‎11-18-2010
My Device: Flash Builder - PlayBook Simulator

Bug? NativeApplication.nativeApplication.openedWindows==null

Don't know if this is a bug, but it looks like so: the nativeApplication.openWindows property returns null where it should return an Array, be it of zero items...

 

I discovered it because it breaks Grant Skinner's FramerateThrottler utility class. Here's the fix for line 76:

 

 

} else if (/* Fix in */ na.openedWindows && /* Fix out */ na.openedWindows.length > 0) {

 That's it!

 

BlackBerry Development Advisor
Posts: 15,889
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Bug? NativeApplication.nativeApplication.openedWindows==null

It looks like it could be an issue.  I have sent this off to our development team for further investigation.  Thanks for reporting this!

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Developer
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: Bug? NativeApplication.nativeApplication.openedWindows==null

Grant's throttler is kinda obselete, newer versions of AIR throttle themselves. AIR for Android throttles itself to 4FPS on DEACTIVATE.

 

My App actually overrides this, and manually throttles down to 1FPS as I found no negative impact.

 

Regardless, openWindows is not going to hold any useful info for you, since Mobile AIR Applications are not "Windowed Applications" they are simply "Applications" they only ever have one open window.

Contributor
Posts: 49
Registered: ‎11-18-2010
My Device: Flash Builder - PlayBook Simulator

Re: Bug? NativeApplication.nativeApplication.openedWindows==null

Can you tell me more about "newer versions of AIR throttle themselves"? This is true for MXML Applications but I'm not sure it is for AS3 only apps. At least I think it doesn't for PB AIR apps!

 

I know this openedWindow Array isn't really useful for PB apps but since it looks like a bug and may break existing APIs I thought it was worth mentioning.

Developer
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: Bug? NativeApplication.nativeApplication.openedWindows==null

Since AIR 2 (I believe) they basically took Grant's idea and added it a a standard feature.

 

So In Desktop Apps, when the window loses focus, you'll see that the App is actually automatically throttled, any animations you have on screen will slow down.

 

In AIR for Android apps, when you deactivate an app, the runtime throttles down to 4FPS, you can verify this by tracing on ENTER_FRAME with an elapsed millisecond count.

 

Now, BlackBerry I'm not sure, and it would be great if msohm could clarify.

 

I would expect that it acts like a standard AIR 2.5 app,  but on the otherhand, I know that they have this nice UI where you can see apps running in the background as you drag to the left or right, so maybe they will not support this throttling behaviour, or implement a less aggressive target framerate?

 

Would be nice to know Smiley Happy

Contributor
Posts: 49
Registered: ‎11-18-2010
My Device: Flash Builder - PlayBook Simulator

Re: Bug? NativeApplication.nativeApplication.openedWindows==null

Oh, I didn't know that!

And do you override this FPS setting? I looked for it in the docs but couldn't find.

 

I think FPS throttling in PB AIR apps is a must-have, you don't want your app to run at full spedd when it's in the background!

Highlighted
Developer
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: Bug? NativeApplication.nativeApplication.openedWindows==null

[ Edited ]

You just add a DEACTIVATE listener to the stage, and then it looks like this:
protected function onDeactivate(event:Event):void {
            model.savePrefs();
            stage.frameRate = 1;
            System.gc();
        }

 

Running a GC pass on deactivate is a good idea, your app will likely not GC itself when it's in background as no user interaction is occuring, so by GCing yourself, you release any unneeded memory, reducing the likelihood your app could be killed off by the OS if it runs low on RAM.

Contributor
Posts: 49
Registered: ‎11-18-2010
My Device: Flash Builder - PlayBook Simulator

Re: Bug? NativeApplication.nativeApplication.openedWindows==null

Uh OK. I thought there was some kind of "NativeApplication.backgroundFramerate"...
So yes, BB should implement that, or tell us they don't, so we know if we have to handle it.
Developer
Posts: 439
Registered: ‎10-25-2010
My Device: Not Specified

Re: Bug? NativeApplication.nativeApplication.openedWindows==null

Ya I don't know of any API to control this throttling behaviour directly, I think it's baked right into the AIR 2.5 runtime. I could be wrong though...

BlackBerry Development Advisor
Posts: 15,889
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Bug? NativeApplication.nativeApplication.openedWindows==null

Deactive apps do not render any AIR windows and their frame rate gets set to 4fps. If there is a native window in the AIR app group, like the video in the video app, it will continue to render unless told otherwise.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.