<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="800" height="500" creationComplete="windowedapplication1_creationCompleteHandler(event)"> <fx:Script> <![CDATA[ import com.greensock.TweenLite; import com.greensock.easing.*; import mx.events.FlexEvent; // variable declarations ------------------------------------ private var timer:Number = 0; private var radius:Number = 300; private var _cosAngle:Number; private var _sinAngle:Number; // getter/setters ------------------------------------------- // helper methods ------------------------------------------- // event handlers ------------------------------------------- protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void { addEventListener(Event.ENTER_FRAME,onFrame); } protected function onFrame(event:Event):void { _cosAngle = Math.cos(timer/100); _sinAngle = Math.sin(timer/100); if(timer % 1 == 0){ var xPos:Number = radius * _cosAngle - radius * _sinAngle; var zPos:Number = radius * _cosAngle + radius * _sinAngle; img.x = xPos + 500; img.z = zPos + 400; img.rotationY = -timer*100/180+30; //TweenLite.to(img,1,{x:(xPos+400),z:(zPos+400)}); } timer++; //trace(posX); } ]]> </fx:Script> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:Image id="img" y="380" source="assets/cc.jpg"/> </s:WindowedApplication>