This seems to return 480 no matter which device I choose. I don’t have a physical device to test on. Can someone comfirm if this happens on a device as well? I’m trying to get my content to fit on Droid and iphone devices. [import]uid: 8673 topic_id: 14125 reply_id: 314125[/import]
In the simulator, it will return the height from your config.lua. [import]uid: 52491 topic_id: 14125 reply_id: 52098[/import]
I think that’s just contentHeight. The viewableContentHeight is supposed to be specific to the device. That’s how you can adjust spacing to suit each device. I ended up taking a screen capture and looking at the height there. Worked fine.
[import]uid: 8673 topic_id: 14125 reply_id: 52122[/import]
Isn’t there something to return the actual device screen height and width as separate from the config.lua? I’m trying to align two buttons to the top left and top right of the screen, no matter which device a user is on…
I can’t find the correct code to detect this dynamically since viewableContentHeight is returning the same as contentHeight… Peach?? [import]uid: 103802 topic_id: 14125 reply_id: 108628[/import]
http://developer.anscamobile.com/reference/index/displayscreenoriginx
Seems more appropriate for what your are trying to do.
From the api page for display.viewableContentHeight:
“A read-only property that contains the height of the viewable screen area in pixels, within the coordinate system of the original content. This is useful since depending on which dynamic scaling mode is used, and the aspect ratio of the device used to view the content, some of the original content may be scaled in such a way that portions are off-screen.”
[import]uid: 84637 topic_id: 14125 reply_id: 108638[/import]
Thanks Danny - display.viewableContentHeight is not returning the height of the viewable screen for me, only the height specified in the config.lua as returned by contentHeight. I had seen displayscreenOrigin.y returning dynamic values, however this is limited. For example I also have a button aligned to the bottom of the screen and screenorigin.y cannot account for this? [import]uid: 103802 topic_id: 14125 reply_id: 108640[/import]