4510 posts Love & Light
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 7-8 years
  • Author had a File in an Envato Bundle
  • Most Wanted Bounty Winner
  • Interviewed on the Envato Notes blog
  • South Africa
+3 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
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 7-8 years
+1 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 ;-)

4510 posts Love & Light
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 7-8 years
  • Author had a File in an Envato Bundle
  • Most Wanted Bounty Winner
  • Interviewed on the Envato Notes blog
  • South Africa
+3 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 ;)

4510 posts Love & Light
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 7-8 years
  • Author had a File in an Envato Bundle
  • Most Wanted Bounty Winner
  • Interviewed on the Envato Notes blog
  • South Africa
+3 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