FORUMS: list search recent posts

Changing a Variable Over Time

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Thomas MaCoy
Changing a Variable Over Time
on May 6, 2012 at 11:37:14 pm

This is one of those things that I assume is either really easy or really hard to do. I have a variable that AS3 assigns some different values to at a couple points in a project (in this case to adjust volume). Normally when you assign a new value, say slider.x = 1, the adjustment is instantaneous. Is there anyway to make a new value assignment gradual? So if slider.x = 1, and the project calls a line of code that says slider.x = 100, I can have that transition over a few seconds rather than instantly? Either by telling it to slowly transition, or by some kind of trick like having it add 5 to slider.x per second for the next 20 seconds?
Thanks for any advice.

Return to posts index

Pieter Helsen
Re: Changing a Variable Over Time
on May 7, 2012 at 12:32:09 am

Hi Thomas,

TweenMax can do just that. TweenMax is the -best- tweening engine you'll be able to find for AS3.

Mostly used for tweening values like x and y positions, it can also tween custom variables if you wish.

You could also use an ENTER_FRAME listener, but TweenMax allows you to do it with less code.

Kind regards,

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.

Return to posts index

Thomas MaCoy
Re: Changing a Variable Over Time
on May 7, 2012 at 6:16:00 am

Wow; that was surprisingly easy to work with, given my limited experience with Flash to date. Thanks!

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved