how can i decrease gravitysetscale in my visible object using function ?

how can i decrease gravitysetscale in my visible objects using function ?

in my game i have falling objects…

when i click the button i want to decrease the gravitysetscale of all the present or visible object and the incoming object.
 

i try this code its work for incoming object buts not a visible or present object…


local gravmin = 0.30

green = display.newImage(“green.png”)
green.x = 159 ; green.y=390

green.gravitysetscale = gravmin


–this is the fuction for button to decrease the gravity setscale

function decreasegravitysetscale()

gravmin =gravmin - 0.20

end


any help and suggest tnx…

When you say:

green.gravitysetscale = gravmin

you are setting it one time.  Changing gravmin later will not go back and update green’s gravity scale.  BTW:  Lua/Corona variables are case sensitive, so that code wouldn’t work anyway, it would lbe:
 

green.gravityScale = gravmin.

Then inside your function you would do something like:

function decreasegravitysetscale()

    gravmin =gravmin - 0.20

    green.gravityScale = gravmin

end

Rob

tnx you Sir Rob hehe

When you say:

green.gravitysetscale = gravmin

you are setting it one time.  Changing gravmin later will not go back and update green’s gravity scale.  BTW:  Lua/Corona variables are case sensitive, so that code wouldn’t work anyway, it would lbe:
 

green.gravityScale = gravmin.

Then inside your function you would do something like:

function decreasegravitysetscale()

    gravmin =gravmin - 0.20

    green.gravityScale = gravmin

end

Rob

tnx you Sir Rob hehe