Your best bet is to adjust the scale of your object using the object:scale() function.
I previously worked out a method for making an object scale up after the user dragged it past a certain line on the screen. For that I created a function called scaleUpToFullSize that was called once the object was dragged past a point. I also used an enterframe listener that did the actual scaling for me (transitions didn’t seem to be working well).
Hopefully you can use little parts of this. Especially the enterframe part, because that’s doing the actual scaling, just make sure you have some way of stopping it or it will just keep going.
Good Luck!
-Matt
W2MD
[lua] local scaleUpToFullsize = function(object)
local xScaleTemp, yScaleTemp = object.xScale, object.yScale
print("xScaleTemp, yScaleTemp: "…tostring( xScaleTemp), tostring( yScaleTemp))
–check for errors
if (xScaleTemp ~= yScaleTemp) then
print(“Error: “…tostring(object)…” is disproportionately scaled!”)
elseif (xScaleTemp == 1) then --object has not been scaled
return true
else --scale up to full size
print(“scaling up!”)
object.scalingUp = true
object.isFullSize = true --just for my own reference
end
end
– Scales objects after they move off of tray
function object:enterFrame( event )
if object.scalingUp == true then
object.xScale = object.xScale + object.xScale/10
object.yScale = object.yScale + object.yScale/10
if object.xScale >= 1.18 then
object.scalingUp = false
object.scalingDown = true
end
elseif object.scalingDown == true then
object.xScale = object.xScale - object.xScale/10
object.yScale = object.yScale - object.yScale/10
if object.xScale <= .9 then
object.xScale = 1
object.yScale = 1
object.scalingUp = false
object.scalingDown = false
end
elseif object.scalingUp == false and object.scalingDown ==false then
Runtime:removeEventListener(“enterFrame”, object)
object.enterFrame = nil
print(“eventlistener enterFrame removed from object”)
end
end
function object:touch( event )
local object, phase = event.target, event.phase
if “began” == phase then
object.isFocus = true
elseif object.isFocus then
if “moved” == phase then
if object.y <= display.contentHeight - TRAYHEIGHT and object.isFullSize == nil then
scaleUpToFullsize(object)
end
end
elseif “ended” == phase or “cancelled” == phase then
display.getCurrentStage():setFocus( nil )
object.isFocus = false
end
end
object:addEventListener( “touch”, object )
Runtime:addEventListener( “enterFrame”, object)[/lua] [import]uid: 10211 topic_id: 14020 reply_id: 51655[/import]