Android 参考点到锚点?(新手)

Android 参考点到锚点?(新手),android,ios,mobile,app-store,coronasdk,Android,Ios,Mobile,App Store,Coronasdk,你能帮我做以下几件事吗。我正在转换一个用以前版本的Corona构建的应用程序。它一直告诉我“object:setReferencePoint()仅在兼容模式下可用。请改用锚点。” 我试着换成下面的,但是运气不好。你能给我指一下正确的方向吗 _G.buttonShowInfo = display.newImageRect( _G.imagePath.."info.png", display.contentWidth*0.12, display.contentHeight*0.08) _G.butt

你能帮我做以下几件事吗。我正在转换一个用以前版本的Corona构建的应用程序。它一直告诉我“object:setReferencePoint()仅在兼容模式下可用。请改用锚点。”

我试着换成下面的,但是运气不好。你能给我指一下正确的方向吗

_G.buttonShowInfo = display.newImageRect( _G.imagePath.."info.png", display.contentWidth*0.12, display.contentHeight*0.08)
_G.buttonShowInfo:info.anchorX = 0.0;
_G.buttonShowInfo:info.anchorY = 1.0;

在您的情况下,我认为第二个代码块是:

_G.buttonShowInfo = display.newImageRect( _G.imagePath.."info.png", display.contentWidth*0.12, display.contentHeight*0.08)
_G.buttonShowInfo.anchorX = 0.0;
_G.buttonShowInfo.anchorY = 1.0;
(有一个:信息不需要)

另外,对于我需要迁移的项目,我创建了这个函数,它涵盖了最常用的参考点转换,它可以在某些特定情况下提供帮助,在这些情况下,您不能只是去替换每个参考点的使用(我的情况就是这样)。如果需要未列出的参考点,可以很容易地添加:):


右下角是1,1不是0,1@Lukis你应该用这个回答,而不是评论。
_G.buttonShowInfo = display.newImageRect( _G.imagePath.."info.png", display.contentWidth*0.12, display.contentHeight*0.08)
_G.buttonShowInfo.anchorX = 0.0;
_G.buttonShowInfo.anchorY = 1.0;
    function referenceToAnchor(oReferencePoint)
     local nAnchorX = 0.0
     local nAnchorY = 0.0

     if oReferencePoint == display.TopLeftReferencePoint then
        nAnchorX = 0.0
        nAnchorY = 0.0
     elseif oReferencePoint == display.CenterReferencePoint then
        nAnchorX = 0.5
        nAnchorY = 0.5
     elseif oReferencePoint == display.BottomLeftReferencePoint then
        nAnchorX = 0.0
        nAnchorY = 1.0
     elseif oReferencePoint == display.BottomRightReferencePoint then
        nAnchorX = 1.0
        nAnchorY = 1.0
     end    
     return nAnchorX, nAnchorY
    end