PDA

View Full Version : What is xoffset really for?


rossbaker
12-05-2006, 09:40 AM
Hi

I've been battling with the old "rotating a view about the center" issue (see various other threads).

The point around which a view is rotated is called the "Registration Point" (RP), which is specified by setting the {xoffset,yoffset} attributes of the view. The default RP is {0,0} which is the upper left-hand corner of the view.

To rotate around a different point, say the center point of the view, you have 2 options:

1) use the "trick" of placing the view inside an invisible container view, and rotating the container view (see full description in other threads);
2) move the RP (ie the xoffset/yoffset).

Moving the RP is fine for the rotation, it works. BUT ...

the RP also affects the placement of the view within it's parent view's coordinate space (parent could be another view or the canvas for example). So, when you change the RP to make your rotation work, you also end up changing the view's location.

Anyway, my real question at this stage, since I'm in the middle of learning all about this stuff, is what is the Registration Point (ie the xoffset and yoffset) for? If you want to MOVE the view, why not just change the x/y values of the view?? Is there a scenario where you'd want to leave the x/y values alone, but use the offsets to move the view?

I can't seem to find any information on the real purpose of these offsets.

Any insight would be greatly appreciated.

Cheers

Ross :)

d~l
12-05-2006, 10:26 AM
Here is one scenario where I have found xoffset and yoffset to be useful ..

clipping a compiled movie to fit inside an HTML div container .. as in skinning components ..

without these offsets if the clipped movie (skin component) is right clicked the settings panel does not appear in dead centre of clipped movie .. and "o.k." button might not be displayed at all, thus locking the movie.

Offsets can also be used to position views "off canvas" and then animate these offset views onto canvas. But I guess negative values of x, y would also allow off canvas positioning.