<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" verticalAlign="top"
horizontalAlign="center"
backgroundGradientColors="[#560707, #6E1C1C]" paddingTop="0" backgroundGradientAlphas="[1.0, 1.0]">
<mx:Script>
<![CDATA[
private function moveImage(ev:MouseEvent):void {
var point:Point = new Point(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" x="10" y="10">
<mx:Text width="100%" color="0x323232" textAlign="center" paddingBottom="10"
text="Click anywhere on the canvas
to move the phone horizontally to 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>
No comments:
Post a Comment