package ch13_1 { import fl.transitions.*; import fl.transitions.easing.*; import flash.display.Graphics; import flash.display.MovieClip; import flash.events.MouseEvent; public class SqueezeText extends MovieClip { public var cv:MovieClip = new MovieClip(); public var g:Graphics = cv.graphics; public var ct:MovieClip = new MovieClip(); public function SqueezeText() { for(var i:uint =0;i<15;i++) { g.beginFill(0xFFFFFF*Math.random()); g.drawRect(i*10,i*10,(15-i)*20,(15-i)*20); g.endFill(); } ct.addChild(cv); cv.x =-cv.width/2; cv.y =-cv.height/2; addChild(ct); ct.x =stage.stageWidth/2; ct.y = stage.stageHeight/2; ct.addEventListener(MouseEvent.CLICK,rotation1); } private function rotation1(e:MouseEvent):void { TransitionManager.start(ct, {type:Squeeze, direction:Transition.IN, duration:2, easing:Elastic.easeOut, dimension:1}); /* 该实例应用 dimension 整数指定为垂直 (1) 的"挤压"过渡。 过渡的内容目标为影片剪辑 ct。该 TransitionManager 实例将应用的效果: 方向为 mx.transitions.Transition.IN、持续时间为 2 秒并且在 easeOut 的方向上有"弹性"缓动效果。 */ } } }