dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: fade image one after another using tween

  1. #1
    Member
    Join Date
    Aug 2008
    Posts
    75

    fade image one after another using tween

    I have 8 images and I want them to sequential fade in. How would I go about doing this? as of now they all fade it at the same time. Thanks in advance

    Code:
    new Tween(image1,"alpha",Regular.easeOut,0,1,2,true);
    new Tween(imag2,"alpha",Regular.easeOut,0,1,2,true);

  2. #2
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    I doubt this is the best way to do it but this is a start:

    PHP Code:
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;

    var 
    images:Array = [image1,image2];// All you need to change is the references to your images here
    var tweens:Array = [];
    var 
    tweenCntr:int 0;

    for(var 
    0images.lengthi++)
    {
        
    images[i].alpha 0;// Initial alpha set to 0
        
    var t:Tween = new Tween(images[i],"alpha",Regular.easeOut,0,1,2,true);
        
    t.addEventListener(TweenEvent.MOTION_FINISHonTweenFinish);// Listner we will use later
        
    t.stop();// Stop tween by default
        
    tweens.push(t);// Store tweens in an array for access later
    }

    // Start the first tween
    tweens[tweenCntr].start();

    // When one tween is finished, move onto the next one
    function onTweenFinish(e:TweenEvent):void
    {
        
    tweenCntr++;
        if(
    tweenCntr tweens.length)
        {
            
    tweens[tweenCntr].start();
        }


  3. #3
    Member
    Join Date
    Aug 2008
    Posts
    75
    thanks, I will try it out

  4. #4
    Junior Member
    Join Date
    Dec 2009
    Posts
    1
    please tell me how i can reference any image there by replacing image1 and image2. what i have to use if my images are in a folder? thank u

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center