Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

transition.to OnComplete param
Started by dweezil Nov 21 2010 09:41 PM

2 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

dweezil

[GLOBAL: userInfoPane.html]
dweezil
  • Contributor

  • 568 posts
  • Corona SDK

Hi, my first transition works but on completion doesn't call the OnComplete function

[blockcode]
transition.to( crossBar, { time=4000, delay=1000, y=display.contentHeight/3, onComplete=doCrossBarUp} )

local function doCrossBarUp()
print("doCrossBarUp()")
transition.to( crossBar, { time=4000, delay=1000, y=-12, onComplete=doCrossBarDown} )
end

local function doCrossBarDown()
transition.to( crossBar, { time=4000, delay=1000, y=display.contentHeight/3, onComplete=doCrossBarUp} )
end

[/blockcode]
uid: 9371 topic_id: 3859 reply_id: 303859


[TOPIC: post.html]
#2

jmp909

[GLOBAL: userInfoPane.html]
jmp909
  • Corona Geek

  • 1,328 posts
  • Corona SDK

your 1st transition doesnt know what your function is yet because it is defined below it.

therefore define your function variable up front. you need to do this when 2 functions call each other since neither can actually be first without referring to the other

local doCrossBarUplocal doCrossBarDowntransition.to( crossBar, { time=4000, delay=1000, y=display.contentHeight/3, onComplete=doCrossBarUp} )  -- note these are actually a local function -- as defined by the variable originallyfunction doCrossBarUp()         print("doCrossBarUp()")        transition.to( crossBar, { time=4000, delay=1000, y=-12, onComplete=doCrossBarDown} )end function doCrossBarDown()        transition.to( crossBar, { time=4000, delay=1000, y=display.contentHeight/3, onComplete=doCrossBarUp} )end
uid: 6645 topic_id: 3859 reply_id: 11772


[TOPIC: post.html]
#3

dweezil

[GLOBAL: userInfoPane.html]
dweezil
  • Contributor

  • 568 posts
  • Corona SDK

Cool, thanks. Is this the best way to implement this type of behaviour?
uid: 9371 topic_id: 3859 reply_id: 11775



[topic_controls]
[/topic_controls]