AS2 Object movement and alpha tween

  • amiecutietoes
  • Newbie
  • Newbie
  • User avatar
  • Joined: Apr 21, 2010
  • Posts: 10
  • Loc: Los Angeles, CA
  • Status: Offline

Post November 17th, 2010, 4:14 pm

So I have so parts of actionscript which I am figuring out on how to make them one. What I am wanting to do is move an object to the right and fadeout.
Here is my code to animate right 10 pixels, this works perfectly.
Code: [ Select ]
(__root.galleryThumbs.length <= 1) ? __root.navigation.button_info._x = 0 : __root.navigation.button_info._x = Math.round((__root.navigation.controls._x + __root.navigation.controls._width) + 10);


As you can see, I am moving "button_info" when the gallery thumbs only has one image in it. Now the code below I wrote up quikly to tween the "button_info" to an alpha of 0.

Code: [ Select ]
Tweener.addTween(__root.navigation.button_info, {_alpha:0, time:0.8, transition:"easeOutExpo"});


My problem is I'm not sure on how to combine the codes :(
Any help is greatly appreciated!
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 17th, 2010, 4:14 pm

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post November 22nd, 2010, 9:54 pm

Why don't you just use Tweener for both? I don't think Tweener will allow you to animate multiple properties in the same call but you can stack them...
ACTIONSCRIPT Code: [ Select ]
Tweener.addTween(__root.navigation.button_info, {_alpha:0, time:0.8, transition:"easeOutExpo"});
Tweener.addTween(__root.navigation.button_info, {_x:10, time:0.8, transition:"easeOutExpo"});
 
  1. Tweener.addTween(__root.navigation.button_info, {_alpha:0, time:0.8, transition:"easeOutExpo"});
  2. Tweener.addTween(__root.navigation.button_info, {_x:10, time:0.8, transition:"easeOutExpo"});
  3.  
basically your just changing the tweened property to be position instead of alpha.

Not that you need one more thing to learn but I find the TweenLite library (http://www.greensock.com/tweenlite/) but be a bit more efficient and easier to use than Tweener. It might be worth looking into since you can tween multiple properties at the same time.
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • amiecutietoes
  • Newbie
  • Newbie
  • User avatar
  • Joined: Apr 21, 2010
  • Posts: 10
  • Loc: Los Angeles, CA
  • Status: Offline

Post November 23rd, 2010, 1:04 am

Thanks :)

I ended up using something called TweenMax

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 54 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.