读书人

Flex 如何实现放大和缩小的功能

发布时间: 2012-03-25 20:55:16 作者: rapoo

Flex 怎么实现放大和缩小的功能
Flex里怎么实现zoomin和zoomout放大和缩小flash的功能

[解决办法]
自己建立zoom特效(effect)
帮助文档示例

Java code
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">    <mx:Script>        <![CDATA[                    import flash.events.MouseEvent;                    public function doZoom(event:MouseEvent):void {                if (zoomAll.isPlaying) {                    zoomAll.reverse();                }                else {                    // If this is a ROLL_OUT event, play the effect backwards.                     // If this is a ROLL_OVER event, play the effect forwards.                    zoomAll.play([event.target], event.type == MouseEvent.ROLL_OUT ? true : false);                }            }        ]]>        </mx:Script>    <mx:Zoom id="zoomAll" zoomWidthTo="1" zoomHeightTo="1" zoomWidthFrom=".5" zoomHeightFrom=".5"  />        <mx:Panel title="Zoom Effect Example" width="95%" height="95%" horizontalAlign="center"        paddingTop="5" paddingLeft="10" paddingRight="10" paddingBottom="5">        <mx:Text width="100%" color="blue"            text="Move the mouse over the image to enlarge it. Move the mouse off of the image to shrink it."/>        <mx:Image id="img"            source="@Embed(source='assets/Nokia_6630.png')"            scaleX=".5" scaleY=".5"            rollOver="doZoom(event)"            rollOut="doZoom(event)"/>    </mx:Panel></mx:Application>
[解决办法]
建议楼主下一个TourDeFlex,
各种例子都有.

读书人网 >flex

热点推荐