动态改变影片的注册点,MC嵌套MC
//引入类
import mx.transitions.*;
import mx.transitions.easing.*;
function Zoom(mc) {
TransitionManager.start(mc, {type:Zoom, direction:Transition.IN, duration:2, easing:Elastic.easeOut});
}
//创建嵌套MC,MC用于Zoom动作,mc.img_mc装载图片
this.createEmptyMovieClip("mc", 2);
this.mc.createEmptyMovieClip("img_mc", 3);
//MovieClipoLoader类加载图片(推荐)
var ml:MovieClipLoader = new MovieClipLoader();
var li:Object = new Object();
//加载完成并执行
li.onLoadInit = function(target:MovieClip) {
//调整装载图片的MC的坐标为舞台中间,宽高与舞台相等
target._width = Stage.width;
target._height = Stage.height;
target._x = -Stage.width/2;
target._y = -Stage.height/2;
//由于装载图片的img_mc的坐标为负值,所以为了让图片在舞台上显示完全,要调整包含它的mc的坐标为相应的正值
target._parent._x = Stage.width/2;
target._parent._y = Stage.height/2;
Zoom(target._parent);
};
ml.addListener(li);
ml.loadClip("a.jpg", mc.img_mc);