代码设置显示对象的注册点
来源:互联网 发布:淘宝联盟上商品优惠券 编辑:程序博客网 时间:2024/04/27 21:45
public static function setRegPoint(obj:DisplayObjectContainer, newX:Number, newY:Number):void {//get the bounds of the object and the location//of the current registration point in relation//to the upper left corner of the graphical content//note: this is a PSEUDO currentRegX and currentRegY, as the//registration point of a display object is ALWAYS (0, 0):var bounds:Rectangle = obj.getBounds(obj.parent);var currentRegX:Number = obj.x - bounds.left;var currentRegY:Number = obj.y - bounds.top;var xOffset:Number = newX - currentRegX;var yOffset:Number = newY - currentRegY;//shift the object to its new location--//this will put it back in the same position//where it started (that is, VISUALLY anyway):obj.x += xOffset;obj.y += yOffset;//shift all the children the same amount,//but in the opposite directionfor(var i:int = 0; i < obj.numChildren; i++) {obj.getChildAt(i).x -= xOffset;obj.getChildAt(i).y -= yOffset;}}这样缩放的时候,就会根据注册点来缩放了
0 0
- 代码设置显示对象的注册点
- c#注册设置代码
- 设置对象(Mesh)的锚点
- AS3.0 设置sprite的锚点,不改变注册点的的函数
- ProgressBar中两种显示图片的设置代码
- 用代码设置控件显示的颜色
- 设置eclipse显示代码错误提示的
- 设置文本框中焦点的位置的实现代码
- Unity3D-在代码中设置RectTransform的锚点、位置
- 【UGUI】代码设置锚点
- c#登入注册设置代码
- smarty 注册对象 并使用 实例代码
- 制作SimpleButton及设置显示对象的热区
- ogre的初始化与启动以及显示对象设置
- 关于Office 365 显示语言的设置(注册开通时的语言选择及注册开通后的语言显示修改)
- 显示客户注册的IP
- 关于Eclipse中代码显示显色的设置问题
- 关于MyEclipse的一些设置(代码提示、显示行号)
- 程序调试概要
- android:shape的使用
- Fragment 的生命周期
- Monkey -C 使用方法
- T0603——建立一个人类(Person)和学生类(Student)
- 代码设置显示对象的注册点
- Python正则表达式指南
- cookie学习总结
- 【编程珠玑】学习笔记3——性能
- 阿斯顿撒的
- android Toast大全(五种情形)建立属于你自己的Toast
- 浅谈linux内存管理机制
- asp.net 根据图片路径生成缩略图
- 收到短信广播,还原短信内容。