4822 posts Interactive Design
  • 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
+7 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 ;-)

4822 posts Interactive Design
  • 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 ;)

4822 posts Interactive Design
  • 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

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by