ThinkNewDev
ThinkNewDev

Reputation: 668

Trying to get positioning after rotation

I built an app in flash where you can rotate objects and save positions and rotation to xml.... that xml then feeds html to produce a layout that is then rendered the a pdf

It seems that every time it goes to the html, a rotated object in positioned a little to the lower right then the position in flash.

I know the rotation in css in different, but I think if I can find the true top left of the rotated object in flash and pass that it will solve the issue.

I tried this

newx = imageHolder.parent.localToGlobal(new Point(imageHolder.x,0)).x;
newy = imageHolder.parent.localToGlobal(new Point(0,imageHolder.y)).y;

also this

imageHolder.parent.globalToLocal(imageHolder.localToGlobal(imageHolder.getBounds(imageHolder).topLeft));

neither work.

Is there something else?

Upvotes: 3

Views: 211

Answers (1)

Matt MacLean
Matt MacLean

Reputation: 19648

Flash rotates the object around the top-left point, and by default CSS rotates around the objects center point.

In the CSS just change the rotation point to use the top left and this should match flash's roation.

CSS:

.objToRotate {
    rotation-point: left top;
}

Upvotes: 1

Related Questions