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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Trusted Contributor
osus
Posts: 160
Registered: ‎04-26-2012
My Carrier: Vodafone

qnx.system.Device.device.screenWidth returns NaN

All the methods related to screen size returns NaN

 

            trace(qnx.system.Device.device.screenWidth);
            trace(qnx.system.Device.device.screenHeight);
            trace(qnx.system.Device.device.screenDiagonal);

 

Have I to do anything to got those values?

 

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords
Please use plain text.
Developer
shaan_softwaredvlpr
Posts: 172
Registered: ‎01-17-2011
My Carrier: Airtel

Re: qnx.system.Device.device.screenWidth returns NaN

i used this code & i am getting 3.6 & 2.2 for height & width respectively.

 

Have you given permission 

<permission>read_device_identifying_information</permission>

 

Please use plain text.
Trusted Contributor
osus
Posts: 160
Registered: ‎04-26-2012
My Carrier: Vodafone

Re: qnx.system.Device.device.screenWidth returns NaN

yes, I have that permission.

I'm testing with simulator, it should work shouldn't it?

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords
Please use plain text.
Developer
shaan_softwaredvlpr
Posts: 172
Registered: ‎01-17-2011
My Carrier: Airtel

Re: qnx.system.Device.device.screenWidth returns NaN

Ok..

 

i have'nt test it on simulator. it BB alpha device it is displaying its values in inches.

As this API checks the hardware detail so may be its restricted in simulator.

 

 

Please use plain text.
Trusted Contributor
osus
Posts: 160
Registered: ‎04-26-2012
My Carrier: Vodafone

Re: qnx.system.Device.device.screenWidth returns NaN

Thank you man! that's probably the problem.

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords
Please use plain text.
Trusted Contributor
Deepu_George_Jacob
Posts: 186
Registered: ‎12-13-2011
My Carrier: Vodafone-IN

Re: qnx.system.Device.device.screenWidth returns NaN

please use stage width, It will return device width

trcae("Width : "+stage.stageWidth)
Please use plain text.
Developer
UberschallSamsara
Posts: 685
Registered: ‎12-29-2010

Re: qnx.system.Device.device.screenWidth returns NaN

[ Edited ]

This works for me on a Dev Alpha:

 

trace("display width is: " + Display.display.getDisplayWidth(0).toString());
trace("display height is: " + Display.display.getDisplayHeight(0).toString());

 

Please use plain text.
Developer
UberschallSamsara
Posts: 685
Registered: ‎12-29-2010

Re: qnx.system.Device.device.screenWidth returns NaN

[ Edited ]

You can also make use of:

 

import flash.system.Capabilities;

	trace("screenDPI is: " + Capabilities.screenDPI.toString());
	trace("screenResolutionX is: " + Capabilities.screenResolutionX.toString());
	trace("screenResolutionY is: " + Capabilities.screenResolutionY.toString());

 

Please use plain text.
Trusted Contributor
Deepu_George_Jacob
Posts: 186
Registered: ‎12-13-2011
My Carrier: Vodafone-IN

Re: qnx.system.Device.device.screenWidth returns NaN

stage.stageWidth and stage.stageHeight is working on my simulator and device
Please use plain text.