Reference Point Error

Hello everybody, I have been getting this annoying error whenever I put anything that has to do with a Reference Point.

This is the error I get: http://gyazo.com/07672812681a81045d0925c87af08c3f

This is my source code:
 

local background = display.newImage("background.png") -- Clock hands local hourHand = display.newImage("hourHand.png", 152, 185) local minuteHand = display.newImage("minuteHand.png", 152, 158) local center = display.newImage("center.png", 150, 230) local secondHand = display.newImage("secondHand.png", 160, 155) hourHand:setReferencePoint(display.BottomCenterReferencePoint) minuteHand:setReferencePoint(display.BottomCenterReferencePoint) secondHand:setReferencePoint(display.BottomCenterReferencePoint) -- Set clock hands position at start local timeTable = os.date("\*t") hourHand.rotation = timeTable.hour \* 30 + (timeTable.min \* 0.5) minuteHand.rotation = timeTable.min \* 6 secondHand.rotation = timeTable.sec \* 6 timeTable = nil -- Reposition every second local function moveHands(e) local timeTable = os.date("\*t") hourHand.rotation = timeTable.hour \* 30 + (timeTable.min \* 0.5) minuteHand.rotation = timeTable.min \* 6 secondHand.rotation = timeTable.sec \* 6 end timer.performWithDelay(1000, moveHands, 0)

It happens with ANY project period.

It would mean a lot if you guys could help me out with this, thanks!

Starting with build numbers greater than 2000, setReferencePoint is no longer a valid API call.  You need to learn about anchor points instead.

http://coronalabs.com/blog/2013/10/15/tutorial-anchor-points-in-graphics-2-0/

Rob

What should I change in the code to for it to work with Anchor Points?

Hi,

Look at attached file.

Require that lua file in your main.lua

It automatically convert reference point value into anchorX,anchorY.

Best Regards,

Team, SP Technolab

www.sptechnolab.com

How do I require the file in my main.lua ?

Sorry for asking

I’ll disagree with the notion of adding something to your project that allows the use of setReferencePoint. It’s been deprecated; it shouldn’t be used. If you have a huge *existing* project and don’t want to go back and change it, then maybe that would be a reason to go that route. Maybe.

Otherwise, especially if starting a new project, just use anchorX/Y and forget about reference points.

Here’s a short video that talks about the difference between the two:

http://masteringcoronasdk.com/blog/using-anchorxy-not-setreferencepoint/

Maybe that’s all you’ll need to get a grasp of it.

 Jay

PS - That video is part of a series, but you can watch just that one to see about anchorX/Y. Just ignore when I’m talking about “other videos.”

Starting with build numbers greater than 2000, setReferencePoint is no longer a valid API call.  You need to learn about anchor points instead.

http://coronalabs.com/blog/2013/10/15/tutorial-anchor-points-in-graphics-2-0/

Rob

What should I change in the code to for it to work with Anchor Points?

Hi,

Look at attached file.

Require that lua file in your main.lua

It automatically convert reference point value into anchorX,anchorY.

Best Regards,

Team, SP Technolab

www.sptechnolab.com

How do I require the file in my main.lua ?

Sorry for asking

I’ll disagree with the notion of adding something to your project that allows the use of setReferencePoint. It’s been deprecated; it shouldn’t be used. If you have a huge *existing* project and don’t want to go back and change it, then maybe that would be a reason to go that route. Maybe.

Otherwise, especially if starting a new project, just use anchorX/Y and forget about reference points.

Here’s a short video that talks about the difference between the two:

http://masteringcoronasdk.com/blog/using-anchorxy-not-setreferencepoint/

Maybe that’s all you’ll need to get a grasp of it.

 Jay

PS - That video is part of a series, but you can watch just that one to see about anchorX/Y. Just ignore when I’m talking about “other videos.”