Changing the case of the first letter to caps for Height didn’t seem to make a difference and made Width no longer work. [import]uid: 6397 topic_id: 1862 reply_id: 5481[/import]
Still can’t get object.height to work, object width works fine, is this a bug? Also I tried using object.scale(.5, .5). This seems to permanently change the scale of the object so I can’t show it larger. Is there a way to restore it to it’s original size? [import]uid: 6397 topic_id: 1862 reply_id: 5571[/import]
It depends what kind of object you’re trying to manipulate. For example, you cannot change the height of a newText object. For everything else you should be able to change with myObject.height = 450
You may also want to look at your object.stageHeight. That may different than object.height depending on your config.lua settings.
Here is an example of a working height transition project:
-- main.lua
local box1Width = 100
local box1Height = 100
local text1 = display.newText("height test", 0, 40, "Courier", 20)
text1:setTextColor(255, 255, 255, 255)
text1.x = display.viewableContentWidth/2
local box1 = display.newRect(0, 0, box1Width, box1Height)
box1:setFillColor(0, 200, 200, 255)
box1.x = display.viewableContentWidth/2; box1.y = display.viewableContentHeight/2
function growBox( event )
local t = event.target
local phase = event.phase
if "ended" == phase then
-- transition.to( t, { time=1000, width=t.width\*2, height=t.height\*2 } )
transition.to( t, { time=1000, height=t.height\*2 } )
end
end
box1:addEventListener( "touch", growBox )
text1:addEventListener( "touch", growBox )