Setting a Center Point for Rotating an Object in FlexWhen you want to rotate an object in Flex, it seems like it would be simple enough to use the "rotation" property of the DisplayObject class to set the number of degrees to rotate the object. However, when you adjust this value, it assumes that the center point of the rotation is x=0 and y=0, and I have not been able to find a way to specify a different center point (also called a registration point) about which to perform the rotation. Although there may be a better solution out there, the workaround I have employed involves using the Rotate class. The Rotate class in the "mx.effects" package allows you to create a motion tween for rotating an object over a specified time duration. The benefit of the Rotate class is that it allows you to specify a center point for the rotation by setting the "originX" and "originY" values. All you have to do is set the duration of the effect to 1 millisecond before invoking the tween, and when played, the object instantaneously rotates about any center point you desire. |
about
contact
rg -at- ryangorer.com
tags
syndication
creations
|