Registration Points

I'm just getting acquainted with Corona and Spriteloq. I imported a sequence in spriteLoq and want to drag it around on the screen, so I applied the code from the DragMe sample project from Corona. However, I also want to flip the image horizontally if the user drags in a negative direction horizontally, so I set the xScale to -1. That's all well and good but the sequence jumps when you flip it so that the area under your finger is no longer the point your originally clicked on. What's the easiest way to fix this? The whole registration point thing is pretty confusing.

Thanks,
Pedro

try to set center registration on the image you drag:

image:setReferencePoint(display.CenterReferencePoint);

Hi Pedro,

Ojnab is correct, but with Spriteloq you set the registeration point with the Align Reference control. It's under the Alignment Controls section (the cross).

When you load a swf, notice the cross in the Animation Preview. That represents the registration point in Flash or the reference point in Corona.

So if you scale an object, it will be with respect to that point.

http://screencast.com/t/8ph19iJA

In the image above the reference point is in the center, so scaling is uniform. But if the point is off center you'll see the scaling flip it away from your control.

If you want to temporarily set the registration point then you should take Onjab's advice and set it manually.

Got it. Thanks.

views:1980 update:2012/2/10 9:26:24
corona forums © 2003-2011