Zoom-in and Zoom-out

I want to scale a picture everytime it is touched.

I used image.xScale = 2
but this works for only the first touch. upon next touch nothing happens. how can i make the scaling occur upon every touch?

Thanks [import]uid: 175611 topic_id: 32915 reply_id: 332915[/import]

image.xScale = image.xScale + 1

Dave [import]uid: 117617 topic_id: 32915 reply_id: 130802[/import]

it does fulfill the purpose of zooming the image. but it also gives an error: attempt to perform arithmetic on field ‘xScale’ [a nil value] [import]uid: 175611 topic_id: 32915 reply_id: 130804[/import]

image.xScale = image.xScale + 1

Dave [import]uid: 117617 topic_id: 32915 reply_id: 130802[/import]

it does fulfill the purpose of zooming the image. but it also gives an error: attempt to perform arithmetic on field ‘xScale’ [a nil value] [import]uid: 175611 topic_id: 32915 reply_id: 130804[/import]

Weird as I use that in my app with no errors. I have a “Zoom +” and “Zoom -” buttons and can press them all day long with no errors.

Dave [import]uid: 117617 topic_id: 32915 reply_id: 131093[/import]

Weird as I use that in my app with no errors. I have a “Zoom +” and “Zoom -” buttons and can press them all day long with no errors.

Dave [import]uid: 117617 topic_id: 32915 reply_id: 131093[/import]

@ali.ayyaz,

I suggest using

[lua]local xScaleFactor = 1.1 – or whatever you need
local yScaleFactor = 1.0

obj:scale( xScaleFactor , yScaleFactor )[/lua]

http://www.youtube.com/watch?v=477APfUXU7s

-Ed

[import]uid: 110228 topic_id: 32915 reply_id: 131270[/import]

@ali.ayyaz,

I suggest using

[lua]local xScaleFactor = 1.1 – or whatever you need
local yScaleFactor = 1.0

obj:scale( xScaleFactor , yScaleFactor )[/lua]

http://www.youtube.com/watch?v=477APfUXU7s

-Ed

[import]uid: 110228 topic_id: 32915 reply_id: 131270[/import]

thank you. it works [import]uid: 175611 topic_id: 32915 reply_id: 131557[/import]

thank you. it works [import]uid: 175611 topic_id: 32915 reply_id: 131557[/import]