这个问题被问的次数多了,所以整理一下,发个贴出来。
以前我碰到这个问题就是直接打个包装MovieClip就不管了,但是对于要访问影片内部的子影片或者其他属性就麻烦了。因为路径改变了。
www.darronschall.com上有一个更好的方法:
通过静态类方法initialize将目标MC加上了几个新属性,_x2,_y2等等新的属性。然后呢,设定新的注册点坐标。
在我们操作_x2,_y2等属性时,实际上是执行了set_x2()等get,set函数,这些函数就执行了一些换算,将我们新设置的值_x2与新设置的注册点位置进行偏移折算,转换成了真正的_x值,这样target_mc就等到了转换之后的_x值,并执行了相应的变化。
(以下内容来自http://www.darronschall.com/weblog/archives/000054.cfm)
先点击此处下载工具类
然后,使用方法如下:
//使用前,先导入类 import com.darronschall.DynamicRegistration;// Assume there is an instance named square_mc on the stage
//你要操作的MC
var square_mc:MovieClip;// updated 7/28/05 - add the dynamic registration stuff at runtime to our square movieclip
//使用DynamicRegistration初始化你的目标MC
DynamicRegistration.initialize(square_mc);// The square_mc has an original registration at 0,0 so
// let's change that to 10, 60 at runtime.
//输入新注册点的坐标
square_mc.setRegistration(10, 60);// Now whenever we access a property of the square_mc that deals
// with the registration point, use a "2" after the property name...
// These are the available properties:
//然后要操作这个MovieClip时就用如下的新属性来操作,只不过是在原来的尾部上加一个2
square_mc._x2 = 4;
square_mc._y2 = 7;
square_mc._rotation2 = 40;
square_mc._xscale2 = 140;
square_mc._yscale2 = 80;
// square_mc._xmouse2 is readonly
// square_mc._ymouse2 is readonly







Comments (6)
我想问一下,使用这个类以后,mc进行scale缩放的时候是以新的注册点为原点进行缩放的吗?
Posted by nickelm | January 11, 2007 1:07 PM
Posted on January 11, 2007 13:07
Scale缩放时要使用_xscale2,_yscale2
square_mc._xscale2 = 140;
square_mc._yscale2 = 80;
Posted by 黑羽 | January 11, 2007 7:28 PM
Posted on January 11, 2007 19:28
你好
看了你很多教程
跟想跟您多学习下AS3
可以加QQ交流吗?
我QQ:66266563
多谢
Posted by 天之痕 | January 16, 2007 5:26 PM
Posted on January 16, 2007 17:26
seen
欢迎回访我的个人BLOG,
阅读了你的这篇文章,
My Blog:听景777
GOOGLE个人空间-
http://tingjing777.blogspot.com/
Posted by SDF | January 16, 2007 8:19 PM
Posted on January 16, 2007 20:19
黑羽说下怎么用Matrix来改变注册点吧
Posted by 赵洪日 | January 20, 2007 1:50 PM
Posted on January 20, 2007 13:50
已经有人弄过了。
看这篇:
http://space.flash8.net/space/html/55/381555_itemid_312725.html
Posted by 黑羽 | January 20, 2007 10:25 PM
Posted on January 20, 2007 22:25