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
osus
Posts: 216
Registered: ‎04-26-2012
My Device: Z10

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 Device: 9500 series

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.
Developer
osus
Posts: 216
Registered: ‎04-26-2012
My Device: Z10

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 Device: 9500 series

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.
Developer
osus
Posts: 216
Registered: ‎04-26-2012
My Device: Z10

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.
Developer
Deepu_George_Jacob
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380

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: 1,026
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

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: 1,026
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

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.
Developer
Deepu_George_Jacob
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380

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

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