object:setDrag( ) supported functions fire before actions on clip dictate

I’m using object:setDrag( ) with a movie clip to perform a drag operation on an object along one axis, but not the other. However, the built in functions call immediately instead of “onDrag” or “onPress” ect. I’m not certain what it is i’m doing wrong. I’m trying to track the drag position, or at least, the resulting position using the onDrag -> dragFunction call.

Code as follows:

[lua]function splashScreen()

local object = movieclip.newAnim({“CON Splash v3-01.png”},960,640)
object.x = display.viewableContentWidth/2
object.y = display.viewableContentHeight/2

local function dragFunction()
object.alpha = 0.5
end

object:setDrag{ drag=true, limitX=false, limitY=true, onDrag=dragFunction()}

–[[
if ((object.x >= display.viewableContentWidth *.75 or object.x <= display.viewableContentWidth *.25)) then
==print(“transition”)

end

print(object.x)
–]]

end

[lua] [import]uid: 13050 topic_id: 11929 reply_id: 311929[/import]

Sorry. Fixed version:

[lua]function splashScreen()

local bkg = display.newImage( “CON Stage v8-01.png”, true )
bkg.x = display.contentWidth/2
bkg.y = display.contentHeight/2

local myAnim = movieclip.newAnim({“CON Splash v3-01.png”},960,640)
myAnim.x = display.viewableContentWidth/2
myAnim.y = display.viewableContentHeight/2

local function pressFunction()
–myAnim.alpha = 0.7
end

local function releaseFunction()
myAnim.alpha = 1.0

if (myAnim.x >= display.viewableContentWidth *.55) then
transition.to(myAnim, {time = 800, x = 1440})
–transition.to(myAnim, {time = 500, alpha = 0})
main()
end
if (myAnim.x <= display.viewableContentWidth *.45) then
transition.to(myAnim, {time = 800, x = -480})
main()
end

end

– Make 2nd sprite draggable
myAnim:setDrag{
drag=true,
limitY=true,
onPress=pressFunction,
onRelease=releaseFunction,
–bounds = { 50, 200, 220, 200 }
}

end
[lua] [import]uid: 13050 topic_id: 11929 reply_id: 43485[/import]