Oki
Oki

Reputation: 43

Applying scaleX/scaleY to a movie clip results in cropped image

So I'm using a swc inside Flash Builder that contains a movie clip.

The problem I have is that I need to scale this movie clip with scaleX and scaleY. This part works fine if I trace the width/height values of the object, but when you actually see the object, it looks as it has been cropped instead of resized.

For example, if I apply a scale factor of 0.5, then I will only see a fourth of the original image, which would be the upper left corner.

The symbol being used and exported to the swc consists of a movie clip that contains another movie clip and this second movie clip contains a shape. Not sure, if this can be affecting the scaling somehow.

Any help would be greatly appreciated.

Upvotes: 2

Views: 813

Answers (1)

gilamran
gilamran

Reputation: 7294

Your movieClip content origin point is not 0,0. When you are scaling a MovieClip (Or any other DisplayObject) you are scaling it in relation to its origin.

Let's say that your MovieClip content is a black rectangle in the size of 200x200, but the rectangle was drawn from 100, 100. The MovieClip was probably placed at -100,-100 to "sit" on the origin. So now, when you scale it to 0.5, you will see only the bottom right...

All you have to do it draw the content from 0,0. and place the movieClip on 0,0 and now when you scale it, it will scale from the top-left corner.

This might help: http://flashexplained.com/basics/understanding-how-the-coordinate-system-in-flash-works/

Upvotes: 1

Related Questions