Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US :: FAQ
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE FLASH:HomeFlash ForumFlash TutorialsFlash Video TutorialsWeb Streaming ForumAdobe FlashPodcast

Changing a Variable Over Time

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
Thomas MaCoyChanging a Variable Over Time
by 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
Reply   Like  

Pieter HelsenRe: Changing a Variable Over Time
by 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.

http://www.greensock.com/tweenmax/

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

Kind regards,
Pieter

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
Reply   Like  

Thomas MaCoyRe: Changing a Variable Over Time
by 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!
-Tom



Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSFEATURESVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2014 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]