Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Image with Tween?

Recommended Posts

I have two picture,and put them into spirte,I want to realize two picture switch effect. I don't know if tweening support it. Example code is better.


Thanks in advance

Link to comment
Share on other sites

hi edward,


i don't know if i totally understand the question but this will allow you to cross-fade between two images in one container sprite


import com.greensock.*;

//initialize alpha of 2 image to 0

//create timeline with tweens to fade image1 out and image 2 in
var tl:TimelineMax=new TimelineMax({});
tl.insert(TweenMax.to(containerSprite.image1, 1, {alpha:0}))
tl.insert(TweenMax.to(containerSprite.image2, 1, {alpha:1}))

btn1.addEventListener(MouseEvent.CLICK, showImage1);
btn2.addEventListener(MouseEvent.CLICK, showImage2);

function showImage1(e:MouseEvent):void{
//tween to beginning of timeline to show image 1

function showImage2(e:MouseEvent):void{
//tween to end of timeline to show image 2

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.