AS3newbie Posted November 11, 2012 Share Posted November 11, 2012 Hi, I couldnt find an answer to this on the forums. Appologies if a similar thread exists. I am as my name suggests; new to greensock and flash-programming. Current code is working and moves the "hero" up and down to fixed locations in my game: private function keyPressed(event:KeyboardEvent):void { if (oppnedcount <2 && event.keyCode==38) { if (oppnedcount == 0) { oppnedcount++; TweenLite.to(hero, 0.3, {y:(421)}); } else { oppnedcount++; TweenLite.to(hero, 0.3, {y:(365)}); } } if (oppnedcount > 0 && event.keyCode==40) { if (oppnedcount == 2) { oppnedcount--; TweenLite.to(hero, 0.3, {y:(421)}); } else { oppnedcount--; TweenLite.to(hero, 0.3, {y:(477)}); } } } "Attatched" to the heros X- and Y-pos i have a running particle-object. Is there a way to rotate the angle of this particle-object DURING the tween of my "hero"? Preferrably using the tweenlite-code and not adding a timer to calculate the 0.3 seconds of my tweens. Thanks in advance, best regards Link to comment Share on other sites More sharing options...
Carl Posted November 12, 2012 Share Posted November 12, 2012 Hi and Welcome to the GreenSock forums. I think what you are looking for is an onUpdate callback for your hero tween. You can define a function that will be called each time the tween updates like so: TweenLite.to(hero, 0.3, {y:421, onUpdate:rotateParticleObject}); function rotateParticleObject():void{ //code for rotating particle trace(hero.x, hero.y) } 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