Transition.to [BUG]

Ok so i think i have found a bug with the newest daily build of Corona.

Here’s some code.

So the onComplete fires when the transition start… Not completes.

centerX = display.contentCenterX centerY = display.contentCenterY local function bobTwo() plusOneHundredTwo = display.newText( "+100", centerX, centerY, "NexaRust", 10 ) local function removeI() display.remove(plusOneHundredTwo) end removePlusTextTwo = transition.to( plusOneHundredTwo, { time = 5000, xScale = 0.5, onComplete = print(1) }) end bobTwo()

–SonicX278

Just tested on an older build – CoronaSDK-2015.2753.msi –  And same thing…

–SonicX278

I got it… For some reason you can’t do print() like this.

transition.to( plusOneHundredTwo, { time=5000, alpha=0.001, onComplete = print(1) } )

You have to do this.

local function removeI() print(1) end transition.to( plusOneHundredTwo, { time=5000, alpha=0.001, onComplete = removeI } )

–SonicX278

onComplete takes a ‘reference’ to a function, not the results (unless that is a reference)

This executes the print statement right way:

transition.to( obj, { time = 5000, xScale = 0.5, onComplete = print(1) } )

This calls it  when the transition completes (via a closure):

transition.to( obj, { time = 5000, xScale = 0.5, onComplete = function() print(1) end } )

Thanks for the explanation. 

–SonicX278

Just tested on an older build – CoronaSDK-2015.2753.msi –  And same thing…

–SonicX278

I got it… For some reason you can’t do print() like this.

transition.to( plusOneHundredTwo, { time=5000, alpha=0.001, onComplete = print(1) } )

You have to do this.

local function removeI() print(1) end transition.to( plusOneHundredTwo, { time=5000, alpha=0.001, onComplete = removeI } )

–SonicX278

onComplete takes a ‘reference’ to a function, not the results (unless that is a reference)

This executes the print statement right way:

transition.to( obj, { time = 5000, xScale = 0.5, onComplete = print(1) } )

This calls it  when the transition completes (via a closure):

transition.to( obj, { time = 5000, xScale = 0.5, onComplete = function() print(1) end } )

Thanks for the explanation. 

–SonicX278