Jump to content
Search Community

Width of Transformed Item changes when rotate [SOLVED]

Boris test
Moderator Tag

Recommended Posts

Hi,

when i rotate one of the objects managed by the Flex Transformmanager, they alter the width between each function call. If you try something like this

 


private function onUpdateTransform(e:TransformEvent):void 
{
_optionsBox.resetDeleteButton(e.items[0].width);
      trace(e.items[0].width)			
}

 

you will recognize, that the value alters, but i only rotate it, nothing more. When i scale or move the item, the width will not alters. I'm confused

 

Best, Boris

Link to comment
Share on other sites

This isn't an error - it's just that Flash measures an item's width by its bounding box which means that when you rotate a box, it becomes wider until it reaches about 45-degrees and then narrower until 90 degrees, etc. You can visualize it by taking a piece of paper and rotating it 45 degrees and then draw a box around the entire paper (the box you draw isn't rotated of course).

Link to comment
Share on other sites

ok i solved this issues - i just calculate the width with the scaleX-Factor

 

private function onFinishInteractiveRotate(e:TransformEvent):void 
		{
			_optionsBox.visible = true;

			var item:TransformItem = e.items[0];
			trace(item.scaleX);

			_optionsBox.x = item.x;
			_optionsBox.y = item.y;
			_optionsBox.rotation = item.rotation;
			_optionsBox.resetDeleteButton(item.scaleX * DEFAULT_BOX_SIZE);
		}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...