4672 posts Love & Light
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Interviewed on an Envato blog
  • Made it to the Authors' Hall of Fame
+8 more
digitalscience says

Been messing around with this for a while but can’t get it right, basically I’m trying to get the arrow to always go around clockwise, depending on which button is pressed, but still keeps going backwards… any ideas? The result must be the arrow stops depending which block is pressed, lol seems simple enough doesn’t it? :D

\\

import mx.transitions.Tween;
import mx.transitions.easing.*;
function tweenAngle(angle) {
    if (Math.abs(0-Number(angle))>180) {
        goToAngle = -Math.abs(0-Number(angle))+2*Math.abs(180-Number(angle));
    } else {
        arrow_mc._rotation = 360;
        goToAngle = Math.abs(0-Number(angle));
    }
    var tween_angle:Tween = new Tween(arrow_mc, "_rotation", null, arrow_mc._rotation, goToAngle, 10, false);
}
bttn1.onPress = function(){
    tweenAngle(90)
}
bttn2.onPress = function(){
    tweenAngle(270)
1633 posts fueledweb.com
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
RimmonTrieu says

Short answer: use TweenLite

http://www.greensock.com/as/docs/tween/com/greensock/plugins/ShortRotationPlugin.html

or

http://www.greensock.com/as/docs/tween/com/greensock/plugins/CirclePath2DPlugin.html

Long answer: The mx Tween class does all internal calculations between tween variables, either writing your own tween function with some math tweaks for expected behavior or using TweenLite for the sake of simplicity.

PS: I guess Wordpress bored you after a while ;-)

4672 posts Love & Light
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Interviewed on an Envato blog
  • Made it to the Authors' Hall of Fame
+8 more
digitalscience says

Short answer: use TweenLite http://www.greensock.com/as/docs/tween/com/greensock/plugins/ShortRotationPlugin.html

or

http://www.greensock.com/as/docs/tween/com/greensock/plugins/CirclePath2DPlugin.html

Long answer: The mx Tween class does all internal calculations between tween variables, either writing your own tween function with some math tweaks for expected behavior or using TweenLite for the sake of simplicity.

PS: I guess Wordpress bored you after a while ;-)

Thanks..Yeh I’m guessing the built in class ain’t gonna cut it, need to use greensock then… Nah this is for a local client job.. still doing the wordpress thing ;)

4672 posts Love & Light
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Interviewed on an Envato blog
  • Made it to the Authors' Hall of Fame
+8 more
digitalscience says
function tweenAngle(angle) {
        goToAngle = angle;
        time = (angle-arrow_mc._rotation)/4
        var tween_angle:Tween = new Tween(arrow_mc, "_rotation", Regular.easeInOut, moon_mc._rotation, goToAngle, time, false);
}
OK turns out just this code will do the trick, wow :O I’m slow today :P
by
by
by
by
by
by