Jump to content
Search Community

reaching alpha and back [SOLVED]

lucca08 test
Moderator Tag

Recommended Posts

hello all,

i have a grid with afew pictures, and im trying to have a movie clip with the different pictures going to alpha at different times at different rates and going back to alpha=100.

 

this is what i have, but its not working...

 

import com.greensock.*;

import com.greensock.easing.*;

import com.greensock.plugins.*;

TweenPlugin.activate([AutoAlphaPlugin]);

 

function forwardTween(){

TweenMax.to(im1, 7, {alpha:0, delay:2, onComplete:reverseTween});

 

}

 

function reverseTween(){

TweenMax.to(im1, 8, {alpha:100, delay:3, onComplete:forwardTween});

 

}

 

can anyone give me a helping hand on this?

 

thanks a lot...

Link to comment
Share on other sites

sorry, but it didnt work... the script that i have below, something is wrong with it except for the 100...

 

it wont fade or comeback...

i tried this:

 

TweenLite.to(im1, 4, {autoAlpha:0});

 

it works great, but i dont know what to do to make the picture appear again....

 

thanks for any help on this.

Link to comment
Share on other sites

hi,

thanks for replying back... yes im using as3...

 

i placed the code you gave me right after the one i had, and it doenst do anything,.. now it doenst even fade...

so i have:

 

import com.greensock.*;

import com.greensock.easing.*;

import com.greensock.plugins.*;

TweenPlugin.activate([AutoAlphaPlugin]);

 

 

TweenLite.to(im1, 4, {autoAlpha:0});

TweenLite.to(im1, 4, {autoAlpha:1});

 

i know it must be something totally stupid im missing.... :(

maybe is there a way of in the same script of the first line, to reverse the tween, without having to write the second line?

Link to comment
Share on other sites

I think you're misunderstanding how code executes in Flash. Tweens take many frames to complete (depending on the duration you set) - your code just starts the tween. Flash doesn't wait for the tween to complete before moving on to the next line of ActionScript.

 

You had one tween right after the other, so the 2nd tween overwrote the first. If you want your object to tween to alpha:0 and THEN tween to alpha:1, you could do either of these:

 

TweenLite.to(im1, 4, {autoAlpha:0});
TweenLite.to(im1, 4, {delay:4, autoAlpha:1, overwrite:0});

 

-OR-

 

TweenLite.to(im1, 4, {autoAlpha:0, onComplete:fadeIn});
function fadeIn():void {
   TweenLite.to(im1, 4, {autoAlpha:1});
}

 

-OR-

 

var timeline:TimelineLite = new TimelineLite();
timeline.append( TweenLite.to(im1, 4, {autoAlpha:0}) );
timeline.append( TweenLite.to(im1, 4, {autoAlpha:1}) );

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...