Change the height of a movieclip from a registration point

耗尽温柔 提交于 2019-12-11 05:07:52

问题


Is there a way to extend only the bottom part of a dynamic Movieclip? I tried to change the height or to scale my mc but it always makes the change relativity to the center of the Movieclip. I guess I should define a registration point and change the height according to it but i'm not sure of how to do it. Hope someone can guide me. Thanks.


回答1:


http://www.flashwonderland.com/transformation-matrix/transformation-matrix-2.html

You can use matrix transforms to achieve that effect.

for a scale from the top use something like this:

var scaleFromTopY:Number = 2;// change this to the correct number.
var scaleFromTopX:Number = 1;// change this as well

var topScaleMatrix:Matrix = new Matrix(
        scaleFromTopX, 0,
        0, scaleFromTopY,
        0, (mc.height*scaleFromTopY)/2 // Make this last part into -(mc.height*scaleFromTopY)/2 to scale from the bottom
);
mc.transform.matrix = topScaleMatrix;

You can also combine matrices with Matrix.concat(m:Matrix);




回答2:


In Flash the registration point can never be changed, to get around this, you must position all the child elements where you want them in relation to the (0,0) point. All transformations will happen around this (0,0) point no matter where the content is placed inside the DisplayObject.



来源:https://stackoverflow.com/questions/8692577/change-the-height-of-a-movieclip-from-a-registration-point

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!