Reputation: 5153
What is the best way to change/set a registration point on a Flex 3 display object? I know this isn't really built in to easily change, but does anyone have any suggestions on how I could extend UIComponent to achieve this?
Upvotes: 6
Views: 1860
Reputation: 2046
Put your DisplayObject inside a sprite and set the DisplayObject's x & y positions to the negitive of your target registration point. Apply all transforms to the Sprite container.
Upvotes: 1
Reputation: 696
For some reason, the Flash Player API doesn't expose the registration point of DisplayObjects
(and the Flash IDE makes them a pain to modify once an object is created). The best solution, as David pointed out, is to add your component as a child of another component (UIComponent
would be fine). So, for example, if I had a Button
and I wanted its registration point at its center, I'd add it as a child of a UIComponent
(not Canvas
) and offset the child by setting its position to (-button.width/2, -button.height/2)
.
Upvotes: 2
Reputation: 10984
Put it inside a Canvas
container, with its clipContent
attribute set to false. Within the canvas, you can put your object wherever you like.
Upvotes: 0