浏览 6081 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-09-28
6.3.2 放缩效果和调整大小效果
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Style source="style.css" /> <mx:Script> <![CDATA[ import mx.effects.Zoom; internal function zoomCanvas():void{ var newZoom:Zoom = new Zoom(); newZoom.zoomHeightFrom =0.01; newZoom.zoomWidthFrom = 0.01; newZoom.originX = 0; newZoom.originY = 0; newZoom.target = Canvas_1; newZoom.duration = 2000; newZoom.play(); } ]]> </mx:Script> <mx:Canvas id="Canvas_1" styleName="box" x="48" y="40" width="200" height="200" > <mx:Text x="15" y="37" text="文本,请注意放大过程中文本的变化" width="166" height="82"/> </mx:Canvas> <mx:Button x="48" y="277" label="放大" click="zoomCanvas()"/> </mx:Application>
始末位置的长宽比例 :zoomWidthFrom、zoomWidthTo、zoomHeightFrom、zoomHeightTo 。取0-1的值。默认1
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Style source="style.css" /> <mx:Script> <![CDATA[ import mx.effects.Resize; import mx.events.TweenEvent; //鼠标动作 internal function resizeCanvas():void{ //创建新的Resize对象 var newResize:Resize = new Resize(); //设定高度和宽度的起始值 newResize.heightFrom = 200; newResize.widthFrom = 200; //高度的最终值 newResize.heightTo = 240; //宽度增加40相当于 widthTo = 240 newResize.widthBy = 40; //指定要隐藏内部元素的Panel newResize.hideChildrenTargets = [Panel_1,Panel_2]; newResize.target = Canvas_1; newResize.duration = 2000; //监听动画的结束事件 newResize.addEventListener(TweenEvent.TWEEN_END,EndHandler); Canvas_1.autoLayout = false; //注释掉这一句代码然后运行程序,观察差别 newResize.play(); } internal function EndHandler(evt:TweenEvent):void{ Canvas_1.autoLayout = true; } ]]> </mx:Script> <mx:Canvas id="Canvas_1" styleName="box" x="26" y="40" width="200" height="200" > <mx:Text x="10" y="10" text="说明:调整大小效果" width="166" height="26"/> <mx:Panel id="Panel_1" styleName="imgPanel" x="10" y="33" width="80%" height="80%" layout="absolute" title="面板一"> <mx:Image x="0" y="0" source="tree.jpg"/> </mx:Panel> </mx:Canvas> <mx:Button x="26" y="293" label="放大" click="resizeCanvas()"/> <mx:Panel id="Panel_2" styleName="imgPanel" x="279" y="40" width="134" height="129" layout="absolute" title="面板二"> <mx:Image x="0" y="0" source="tree.jpg"/> </mx:Panel> </mx:Application>
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2009-04-28
我想问你一下你的引入的css文件在哪里?
|
|
返回顶楼 | |