我正在将一组对象插入到具有图像rect的父组中,据我所知,例外结果应该是外部组将从屏幕的左上角开始(0,0)内部组将引用父组的左上角,实际上就像我在外组中没有图像rect所描述的那样,问题是当外组的内部有一个图像时,所以外组中心点是在屏幕的左上角,内部组是否在父组的中心?
发生了什么事?请帮忙......
local checkinContent = display.newGroup();
local BG= display.newImageRect(checkinContent,"images/magen-david_backgound.png",display.contentWidth, 0.45822 * display.contentHeight);
checkinContent:setReferencePoint(display.TopLeftReferencePoint);
checkinContent.y = display.contentHeight - checkinContent.height;
checkinContent.x = 0;
local circlesGroup = display.newGroup();
circlesGroup:setReferencePoint(display.TopCenterReferencePoint);
circleTable[0] = display.newImageRect(circlesGroup,"images/circle.png",0.0265 * display.contentWidth, 0.0265 * display.contentWidth);
circleTable[1] = display.newImageRect(circlesGroup,"images/circle.png",0.0265 * display.contentWidth, 0.0265 * display.contentWidth);
circleTable[2] = display.newImageRect(circlesGroup,"images/circleCurrent.png",0.0265 * display.contentWidth, 0.0265 * display.contentWidth);
circlesGroup.y = 0;
checkinContent:insert(circlesGroup);
答案 0 :(得分:1)
好吧,有时日冕就像在黑暗中行走...... 这是一个video的答案..
视频中的关键句是:
“奇怪的是,一旦这个被创建,并且就位,它会改变参考点到中心......为什么?!我没有怪异的想法......”
答案 1 :(得分:0)
更新以下代码行:
local circlesGroup = display.newGroup();
circleTable[0] = display.newImageRect(circlesGroup,"images/circle.png",0.0265 * display.contentWidth, 0.0265 * display.contentWidth);
circleTable[1] = display.newImageRect(circlesGroup,"images/circle.png",0.0265 * display.contentWidth, 0.0265 * display.contentWidth);
circleTable[2] = display.newImageRect(circlesGroup,"images/circleCurrent.png",0.0265 * display.contentWidth, 0.0265 * display.contentWidth);
checkinContent:insert(circlesGroup);
circlesGroup:setReferencePoint(display.TopCenterReferencePoint);
circlesGroup.y = 0;