加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex图片处理特效

发布时间:2020-12-15 03:57:04 所属栏目:百科 来源:网络整理
导读:1. 添加字符 ?xml version="1.0"encoding="utf-8"? mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top" ???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSource

1.添加字符

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Script>

???????<![CDATA[

???????????import mx.effects.easing.Elastic;

???????????import mx.collections.ArrayCollection;

???????????

???????????[Bindable]

???????????private var myDP:ArrayCollection =newArrayCollection(

?? ?????????????['A','B','C','D']);

????????????

???????????private var dpArr:Array = ['A','D','E','F','G','H','I','J','K','L','M','N','O','P'];

???????????

???????????private function deleteItem():void {

??????????????? // Remove item from Array Collection

??????????????? if(myDP.length > 0){

???????????????????myDP.removeItemAt(myDP.length-1);

???????????????? }

???????????}

?

???????????private var zcount:int = 0;

???????????private function addItem():void {

??????????????? // Add item from sourceArray to Array Collection

??????????????? if(myDP.length <dpArr.length){

???????????????????myDP.addItemAt(dpArr[myDP.length],myDP.length);

??????????????? }

???????????}???????????????????????

???????]]>

???</mx:Script>

???

???<!-- Define a custom data effect as a Sequence effect. -->

???<mx:Sequence id="itemsChangeEffect1">

???????<mx:Blur blurYTo="12" blurXTo="12"duration="300" perElementOffset="150"filter="removeItem"/>

???????

???????<mx:Parallel>

???????????<mx:Move duration="750"easingFunction="{Elastic.eaSEOut}"perElementOffset="20"/>

???????????

???????????<mx:RemoveItemAction startDelay="400"filter="removeItem"/>

???????????

???????????<mx:AddItemAction startDelay="400"filter="addItem"/>

???????????

???????????<mx:Blur startDelay="410" blurXFrom="18"blurYFrom="18" blurXTo="0" blurYTo="0"duration="300" filter="addItem"/>

???????</mx:Parallel>

???</mx:Sequence>

???

???<mx:Paneltitle="AddItemActionEffect/RemoveItemActionEffect"layout="vertical" color="0xffffff" borderAlpha="0.15"width="500" height="240"

????????paddingTop="10" paddingRight="10"paddingBottom="10" paddingLeft="10"horizontalAlign="center">

????????

?????????<!-- This TileList uses a custom data change effect -->

???????<mx:TileList id="tlist0" ?color="0x323232"height="100%" width="100%" fontSize="18"fontStyle="bold"

???????????columnCount="4" rowCount="4"direction="horizontal" dataProvider="{myDP}"itemsChangeEffect="{itemsChangeEffect1}"/>

???

???????<mx:Button label="Remove item" click="deleteItem();"color="0x323232"/>

???????<mx:Button label="Add item" click="addItem();"color="0x323232"/>

?

???</mx:Panel>

</mx:Application>

?

2.图片横向拉扯

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Script>

???????<![CDATA[

???????????private function smoothImage(ev:Event):void{

??????????????? //set image smoothing soimage looks better when transformed.

??????????????? var bmp:Bitmap =ev.target.content as Bitmap;

???????????????bmp.smoothing =true;

???????????}

???????]]>

???</mx:Script>

???<mx:Sequence id="animateScaleXUpDown" >

???????<mx:AnimateProperty property="scaleX"fromValue="1" toValue="3" duration="300" />

???????<mx:AnimateProperty property="scaleX" fromValue="3"toValue="1" duration="1000" />???

???</mx:Sequence>

???????

???<mx:Panel title="AnimateProperty Effect"layout="vertical" color="0xffffff"borderAlpha="0.15" width="500"

????????paddingTop="10" paddingRight="10"paddingBottom="10" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="10"

???????????text="Click on the image to use the AnimateProperty effect with thescaleX property."/>

?

???????<mx:Image id="flex" source="@Embed('此处是你的图片路径')"mouseDownEffect="{animateScaleXUpDown}"creationComplete="smoothImage(event);"/>

?

???</mx:Panel>

???

</mx:Application>

.

3.图像模糊处理

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Blur id="blurImage" duration="1000"

???????blurXFrom="0.0" blurXTo="10.0"

???????blurYFrom="0.0" blurYTo="10.0"/>

???<mx:Blur id="unblurImage" duration="1000"

???????blurXFrom="10.0" blurXTo="0.0"

???????blurYFrom="10.0" blurYTo="0.0"/>

???????

???<mx:Panel title="Blur Effect" layout="vertical"color="0xffffff" borderAlpha="0.15" width="500"

????????paddingTop="10" paddingRight="10"paddingBottom="10" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="10"

???????????text="Click and hold the mouse on the image to see blurImageeffect. Release the mouse to see the unblurImage effect."/>

?

???????<mx:Image id="flex" source="@Embed(‘此处是你的图片路径’)"mouseDownEffect="{blurImage}"mouseUpEffect="{unblurImage}"/>

?

???</mx:Panel>

???

</mx:Application>

?

4.图像有无

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Dissolve id="dissolveOut" duration="1000"alphaFrom="1.0" alphaTo="0.0"/>

???<mx:Dissolve id="dissolveIn" duration="1000"alphaFrom="0.0" alphaTo="1.0"/>

???????

???<mx:Panel title="Dissolve Effect"layout="vertical" color="0xffffff"borderAlpha="0.15" width="500"

????????paddingTop="10" paddingRight="10"paddingBottom="10" paddingLeft="10"horizontalAlign="center">

????????<mx:HBox width="90%" height="100%"horizontalGap="50" horizontalAlign="center">

????????

????????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="10"hideEffect="{dissolveOut}" showEffect="{dissolveIn}"visible="{cb1.selected}"

??????????????? text="Use the Dissolveeffect to show or hide the text,image,and button. The Dissolve effect workswith system and embedded fonts,unlike the Fade effect which requires embeddedfonts."/>

?

???????????<mx:Image id="flex" source="@Embed('images/backpack.jpg')"visible="{cb1.selected}" hideEffect="{dissolveOut}"showEffect="{dissolveIn}"/>

???????

???????</mx:HBox>

???????

???????<mx:ControlBar horizontalAlign="center">

???????????<mx:CheckBox id="cb1" label="visible" selected="true"textRollOverColor="0xACACAC"textSelectedColor="0xACACAC"/>

???????</mx:ControlBar>

???</mx:Panel>

???

</mx:Application>

5.图片由小到大的播放

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Script>

???????<![CDATA[

???????????

???????????import mx.controls.Alert;

?

???????????// Event handler for the effectEnd event.???????????

???????????private function endEffectHandler():void {

??????????????? Alert.show("EffectEnded!");

??????????????? button1.enabled=false;

??????????????? button2.enabled=false;

??????????????? button3.enabled=false;

??????????????? button4.enabled=false;

??????????????? button5.enabled=false;

??????????????? button6.enabled=true;

???????????}

???????????

???????????// Event handler for the reset button.???????????

???????????private function resetHandler():void {

??????????????? expand.end();

??????????????? img.width=30;

??????????????? img.height=60;

??????????????? button1.enabled=true;

??????????????? button2.enabled=false;

??????????????? button3.enabled=false;

??????????????? button4.enabled=false;

??????????????? button5.enabled=false;

???????????}

???????????

???????????private function startHandler():void {

???????????????expand.play();

??????????????? button1.enabled=false;

??????????????? button2.enabled=true;

??????????????? button3.enabled=false;

??????????????? button4.enabled=true;

??????????????? button5.enabled=true;

??????????????? button6.enabled=true;

???????????}

???????????

???????????// Event handler for the reset button.???????????

???????????private function pauseHandler():void {

??????????????? expand.pause();

??????????????? button2.enabled=false;

??????????????? button3.enabled=true;

???????????}

???????????

???????????private function resumeHandler():void {

??????????????? expand.resume();

?????????????????? button2.enabled=true;

??????????????? button3.enabled=false;

???????????}

???????????

???????????private function endHandler():void {

??????????????? expand.end();

??????????????? button1.enabled=false;

??????????????? button2.enabled=false;

??????????????? button3.enabled=false;

??????????????? button4.enabled=false;

??????????????? button5.enabled=false;

???????????}

???????????

??? ????????private functionreverseHandler():void{

??????????????? expand.reverse();

???????????}

???????????

???????????private function smoothImage(ev:Event):void{

??????????????? //set image smoothing soimage looks better when transformed.

???????????????var bmp:Bitmap =ev.target.contentas Bitmap;

??????????????? bmp.smoothing =true;

???????????}

???????]]>

???</mx:Script>

???

???<mx:Resize id="expand" target="{img}"widthTo="120" heightTo="120"

???????duration="10000" effectEnd="endEffectHandler();"/>

???????

???<mx:Panel title="Effect" layout="vertical"color="0xffffff" borderAlpha="0.15" width="500"height="240"

????????paddingTop="5" paddingRight="10"paddingBottom="10" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="5"

???????????text="Use the Button controls to control the Resizeeffect."/>

?

???????<mx:Image id="img" width="23"height="24" source="@Embed('images/helmet.jpg')"creationComplete="smoothImage(event);" />

???????

???????<mx:ControlBar horizontalAlign="center">

???????????<mx:Button id="button1" label="Start"click="startHandler();"/>

???????????<mx:Button id="button2" label="Pause"click="pauseHandler();" enabled="false"/>

???????????<mx:Buttonid="button3" label="Resume"click="resumeHandler();" enabled="false"/>

???????????<mx:Button id="button4" label="Reverse"click="reverseHandler();" enabled="false"/>

???????????<mx:Button id="button5" label="End"click="endHandler();" enabled="false"/>

???????????<mx:Button id="button6" label="Reset"click="resetHandler();" enabled="false"/>

???????</mx:ControlBar>

???????

???</mx:Panel>

???

</mx:Application>

?

6.图片蓝色外光环

<?xml version="1.0"encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"layout="vertical" verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Glow id="glowImage" duration="1000"alphaFrom="1.0" alphaTo="0.3" blurXFrom="0.0"blurXTo="50.0" blurYFrom="0.0" blurYTo="50.0"color="0x22A050"/>

???

???<mx:Glow id="unglowImage" duration="1000"alphaFrom="0.3" alphaTo="1.0" blurXFrom="50.0"blurXTo="0.0" blurYFrom="50.0" blurYTo="0.0"color="0x3380DD"/>

???????

???<mx:Panel title="Glow Effect" layout="vertical"color="0xffffff" borderAlpha="0.15" width="500"

????????paddingTop="10" paddingRight="10"paddingBottom="10" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="10"

???????????text="Click and hold the mouse on the image to see glowImageeffect. Release the mouse to see unglowImage effect."/>

?

???????<mx:Image id="flex"source="@Embed('images/helmet.png')" mouseDownEffect="{glowImage}"mouseUpEffect="{unglowImage}"/>

?

???</mx:Panel>

???

</mx:Application>

?

7.图片成方块式消失

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Iris id="irisOut" duration="1000"showTarget="true"/>

???<mx:Iris id="irisIn" duration="1000"showTarget="false"/>

???????

??? <mx:Panel title="Iris Effect"layout="vertical" color="0xffffff"borderAlpha="0.15" width="500"

????????paddingTop="10" paddingRight="10"paddingBottom="10" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="10"

???????????text="Use the Iris effect to show or hide the image."/>

?

???????<mx:Image id="flex"source="@Embed('images/goggles.jpg')"visible="{cb1.selected}" showEffect="{irisIn}"hideEffect="{irisOut}"/>

???? ???

???????<mx:ControlBar horizontalAlign="center"paddingBottom="0" paddingTop="0">

???????????<mx:CheckBox id="cb1" label="visible"selected="true" textRollOverColor="0xACACAC"textSelectedColor="0xACACAC"/>

???????</mx:ControlBar>

???</mx:Panel>

?? ?

</mx:Application>

?

8.点击图片移动

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Script>

???????<![CDATA[

?

???????????private function moveImage(ev:MouseEvent):void {

??????????????? var point:Point = newPoint(mouseX,mouseY);

??????????????? var localPoint:Point =canvas.globalToLocal(point);

?

??????????????? myMove.end();

??????????????? myMove.xTo=localPoint.x -(img.width/2);

??????????????? myMove.play();

???????????}

?????]]>

???</mx:Script>

?

???<mx:Move id="myMove" target="{img}"/>

???

???<mx:Sequence id="animateScaleXUpDown" >

???????<mx:AnimateProperty property="scaleX"fromValue="1" toValue="3" duration="300" />

???????<mx:AnimateProperty property="scaleX"fromValue="3" toValue="1" duration="1000"/>???

???</mx:Sequence>

???????

???<mx:Panel title="Move Effect" layout="vertical"color="0xffffff" borderAlpha="0.15" width="500"

????????paddingTop="10" paddingRight="10"paddingBottom="10" paddingLeft="10"horizontalAlign="center">

????????

???????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="10"

???????????text="Click anywhere on the canvas to move the phone horizontallyto that position"/>

???????

???????<mx:Canvas?id="canvas" width="100%" height="100%"mouseDown="moveImage(event);">

???????????

???????????<mx:Image id="img" source="@Embed('images/goggles.jpg')"/>

???????????

???????</mx:Canvas>

?

???</mx:Panel>

???

</mx:Application>

?

9.放大缩小处理

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Script>

???????<![CDATA[

???????????private function smoothImage(ev:Event):void{

??????????????? //set image smoothing soimage looks better when transformed.

??????????????? var bmp:Bitmap =ev.target.content as Bitmap;

???????????????bmp.smoothing =true;

???????????}

???????]]>

???</mx:Script>

???<mx:Parallel id="expand" target="{img}">

???????<mx:Move xTo="{canvas.width/2 - 60}"yTo="{canvas.height/2-60}"/>

???????<mx:Resize widthTo="120" heightTo="120"/>

???</mx:Parallel>

?

???<mx:Parallel id="contract" target="{img}">

???????<mx:Move xTo="{canvas.width/2-12}"yTo="{canvas.height/2-12}"/>

???????<mx:Resize widthTo="24" heightTo="24"/>

???</mx:Parallel>

???????

???<mx:Panel title="Parallel Effect" layout="vertical"color="0xffffff" borderAlpha="0.15" width="500"height="240"

????????paddingTop="5" paddingRight="10"paddingBottom="5" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="5"

???????????text="Use the Button controls to move and resize the phone image inparallel."/>

???????

???????<mx:Canvas id="canvas" width="100%"height="100%">

???????????<mx:Image id="img" x="{canvas.width/2 - 12}"y="{canvas.height/2 - 12}" width="24" height="24"source="@Embed('images/compass.jpg')"creationComplete="smoothImage(event);"/>

???????</mx:Canvas>

?

???????<mx:ControlBar horizontalAlign="center" >

???????????<mx:Button label="Expand" click="expand.end();expand.play();"/>

???????????<mx:Buttonlabel="Contract" click="contract.end();contract.play();"/>

???????</mx:ControlBar>

?

???</mx:Panel>

???

</mx:Application>

10.点击颤抖移动

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Script>

???????<![CDATA[

???????????import mx.effects.easing.*;??????????????????

???? ???]]>

???</mx:Script>

?

???<mx:Sequence id="movePauseMove">

???????<mx:Move xBy="150" duration="2000"easingFunction="Bounce.eaSEOut"/>

???????<mx:Pause duration="2000"/>

???????<mx:Move xBy="-150" duration="2000"easingFunction="Bounce.easeIn"/>

??? </mx:Sequence>

???????

???<mx:Panel title="Pause Effect" layout="vertical"color="0xffffff" borderAlpha="0.15" width="500"

????????paddingTop="10" paddingRight="10"paddingBottom="10" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="10"

???????????text="Click the image to start the Sequence effect. The effectpauses for 2 seconds between moves."/>

?

???????<mx:Image id="flex"source="@Embed('images/helmet.jpg')"?mouseDownEffect="{movePauseMove}"/>

?

???</mx:Panel>

???

</mx:Application>

?

11.点击旋转45°

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Script>

???????<![CDATA[

?

???????????[Bindable]

???????????public var angle:int=0;

?

???????????private function rotateImage():void {

??????????????? rotate.end();

??????????????? angle += 45;

??????????????? rotate.play();

???????????}

?????]]>

???</mx:Script>

???

???<mx:Rotate id="rotate" angleFrom="{angle-45}"angleTo="{angle}" target="{img}"/>

???

???<mx:Panel title="Rotate Effect" layout="vertical"color="0xffffff" borderAlpha="0.15" width="500"

????????paddingTop="5" paddingRight="10"paddingBottom="5" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center"

???????????text="Click the button to rotate the image 45 degrees. Use anembedded font when applying the Rotate effect to text."/>

?

???????<mx:Image id="img"source="@Embed('images/flxb_3.png')" />

???????

???????<mx:ControlBar horizontalAlign="center"paddingTop="2" paddingBottom="2">

???????????<mx:Button label="Rotate 45 Degrees"click="rotateImage();"/>

???????</mx:ControlBar>

???????

???</mx:Panel>

???

</mx:Application>

?

12.点击图片听音乐

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:SoundEffect id="mySounds"source="@Embed('assets/whistle.mp3')"/>

???????

???<mx:Panel title="SoundEffect" layout="vertical"color="0xffffff" borderAlpha="0.15" width="500"

????????paddingTop="5" paddingRight="10"paddingBottom="5" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="5"

???????????text="Click on the image to hear the sound effect."/>

?

???????<mx:Image id="flex"source="@Embed('images/goggles.jpg')"mouseDownEffect="{mySounds}"/>

?

???</mx:Panel>

???

</mx:Application>

?

13.图片由上到下消失

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center"backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:WipeDown id="wipeOut" duration="1000"/>

???<mx:WipeDown id="wipeIn" duration="1000"/>

???????

???<mx:Panel title="WipeDown Effect"layout="vertical" color="0xffffff"borderAlpha="0.15" width="500" height="240"

????????paddingTop="5" paddingRight="10"paddingBottom="0" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="5"

???????????text="Use the WipeDown effect to show or hide the text and image."/>

???????

???????<mx:Image id="flex"source="@Embed('images/compass.jpg')"visible="{cb1.selected}" hideEffect="{wipeOut}"showEffect="{wipeIn}"/>

???????

???????<mx:Label color="0x323232" text="Flex"fontSize="14" visible="{cb1.selected}" hideEffect="{wipeOut}"showEffect="{wipeIn}"/>

???????

???????<mx:ControlBar horizontalAlign="center"paddingBottom="0" paddingTop="0">

???????????<mx:CheckBox id="cb1" label="visible"selected="true" textRollOverColor="0xACACAC"textSelectedColor="0xACACAC"/>

???????</mx:ControlBar>

???</mx:Panel>

???

</mx:Application>

?

14.鼠标移动到图片上图片自动放大

<?xml version="1.0"encoding="utf-8"?>

<mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"verticalAlign="top"

???horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]"paddingTop="0" viewSourceURL="srcview/index.html">

???

???<mx:Script>

???????<![CDATA[???????

???????????import flash.events.MouseEvent;

???????

???????????public function doZoom(event:MouseEvent):void {

???? ???????????if (zoomAll.isPlaying) {

??????????????????? zoomAll.reverse();

??????????????? }

??????????????? else {

??????????????????? // If this is a ROLL_OUTevent,play the effect backwards.

??????????????????? // If this is aROLL_OVER event,play the effect forwards.

???????????????????zoomAll.play([event.target],event.type == MouseEvent.ROLL_OUT ?true: false);

??????????????? }

???????????}

???????????private function smoothImage(ev:Event):void{

??????????????? //set image smoothing soimage looks better when transformed.

??????????????? var bmp:Bitmap =ev.target.content as Bitmap;

??????????????? bmp.smoothing =true;

???????????}

???????]]>???

???</mx:Script>

?

???<mx:Zoom id="zoomAll" zoomWidthTo="1"zoomHeightTo="1" zoomWidthFrom=".5"zoomHeightFrom=".5"? />

??????

???<mx:Panel title="Zoom Effect" layout="vertical"color="0xffffff" borderAlpha="0.15" width="500"height="230"

????????paddingTop="5" paddingRight="10"paddingBottom="5" paddingLeft="10"horizontalAlign="center">

????????

????????<mx:Text width="100%" color="0x323232"textAlign="center" paddingBottom="0"

???????????text="Move the mouse over the image to enlarge it. Move the mouSEOff of the image to shrink it."/>

?

???????<mx:Image id="flex" source="@Embed('images/goggles.jpg')"scaleX=".5" scaleY=".5" rollOver="doZoom(event)"rollOut="doZoom(event)"creationComplete="smoothImage(event);" />

?

???</mx:Panel>

???

</mx:Application>

?

entity.endEffectsStarted();? //结束组件上当前播放的所有效果。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读