5306 posts Interactive Design
  • Elite Author
  • Author Level 10
  • Trendsetter
  • Top Monthly Author
+11 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
  • Affiliate Level 2
  • Author Level 8
  • Collector Level 2
  • Top Monthly Author
+8 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 ;-)

5306 posts Interactive Design
  • Elite Author
  • Author Level 10
  • Trendsetter
  • Top Monthly Author
+11 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 ;)

5306 posts Interactive Design
  • Elite Author
  • Author Level 10
  • Trendsetter
  • Top Monthly Author
+11 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