Share Posted June 13, 2011 This is more of my rotating wheel thing. I have a wheel that rotates when a user clicks on a button contained on the wheel; the amount of rotation depends on which button is clicked. When the button is clicked, the wheel rotates and a small animation plays, also depending on which button was clicked. I want the Wheel mc to play the animation associated with its first position - when the Wheel mc loads for the first time ONLY. I can't seem to get this to happen, most likely due to being stuck in AS2 syntax. Here's the code: import com.greensock.*; import com.greensock.easing.*; //this is what's not working, and it also prevents the rest of the script from working properly // Wheel.addEventListener(Event.ENTER_FRAME,spinInit); function spinInit(event:Event):void { TweenMax.to(Wheel, .5, {rotation:30, ease:Cubic.easeIn}); Clients.gotoAndPlay("As"); } //end of what doesn't work // Wheel.A.addEventListener(MouseEvent.CLICK,spin); function spin(event:MouseEvent):void { TweenMax.to(Wheel, .5, {rotation:30, ease:Cubic.easeIn}); Clients.gotoAndPlay("As"); } Wheel.B.addEventListener(MouseEvent.CLICK,spin2); function spin2(event:MouseEvent):void { TweenMax.to(Wheel, .5, {rotation:20, ease:Cubic.easeIn}); Clients.gotoAndPlay("Bs"); } etc etc etc TIA for your suggestions Link to comment Share on other sites More sharing options...
Share Posted June 13, 2011 I don't think ENTER_FRAME is what you want because that will happen repeatedly... if you want something to happen just once create a function to do that thing and call the function once. function spinInit():void { TweenMax.to(Wheel, .5, {rotation:30, ease:Cubic.easeIn}); Clients.gotoAndPlay("As"); } //when Wheel loads just do: spinIt(); Link to comment Share on other sites More sharing options...
Author Share Posted June 14, 2011 That's it, thanks. I've really got to try and get my head around AS3. I don't do as much Flash stuff as I used to, but I don't want to be forever stuck in AS2 syntax... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now