object.contentWidth Warning

Hello all,

I am getting the following warning in the Terminal window when I run my app.

“WARNING: object.stageWidth has been deprecated. Use object.contentWidth instead”
These are the relevant bits of my code which causes the error (I believe)

[lua] local ui = require ( “ui” )
local scnW = display.contentWidth
local scnH = display.contentHeight
local sLat = "Lat: "

lblLatDM = ui.newLabel{
bounds = {(scnW/20), ((scnH/20)*3), 180, 40},
text = sLat,
textColor = {255, 255, 255, 255},
size = 26,
align = “left”
}[/lua]

Can anyone explain to me what I am doing wrong, and why I am getting these warnings?

Thank you

Robin [import]uid: 74250 topic_id: 12488 reply_id: 312488[/import]

Hey,

Your code is fine and wont throw off any errors. Open every Lua file in your app, press CMD+F and search for “stageWidth”.

I’m betting that one of your files has that in it somewhere - let me know :slight_smile:

Peach [import]uid: 52491 topic_id: 12488 reply_id: 45786[/import]

Hi Peach,

Yes you were right, my ui.lua must have been an older one.

I have replaced it with a new one & now have no warnings.

Many thanks

Robin [import]uid: 74250 topic_id: 12488 reply_id: 45791[/import]

No worries; it’s happened to me enough times :wink:

Peach :slight_smile: [import]uid: 52491 topic_id: 12488 reply_id: 45887[/import]