A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: fading image transitions in actionscript 3

  1. #1
    Member
    Join Date
    Feb 2009
    Posts
    30

    fading image transitions in actionscript 3

    I'm trying to create a simple yet effective image slideshow for my homepage. it'll be a bar, 600 pixels wide, by 300 pixels high. There will be 4 buttons that will line the bottom, numbered 1 through 4, that will control 4 separate slides that'll appear in that window. If you don't click anything, the images will fade in and out after x amount of seconds. Clicking on the numbered buttons will load the appropriate slide, and each slide when clicked will take you to a certain part of the website.

    I wish to do this in actionscript... not using the timeline as I prefer to do all transitions in actionscript. Can anyone shed light on how to set this up? I've been trying to use the TransitionManager function... however I'm getting mixed results. Here's a screenshot:



    Here's my clumsy code... that doesn't work at all lol

    Code:
    import fl.transitions.*;
    import fl.transitions.easing.*;
    
    ss1_mc.alpha = 1;
    ss2_mc.alpha = 0;
    ss3_mc.alpha = 0;
    ss4_mc.alpha = 0;
    
    var currentImage:MovieClip = ss1_mc;
      
    one_mc.addEventListener(MouseEvent.CLICK, nextImage);
    two_mc.addEventListener(MouseEvent.CLICK, nextImage);
    three_mc.addEventListener(MouseEvent.CLICK, nextImage);
    four_mc.addEventListener(MouseEvent.CLICK, nextImage);
    
    one_mc.targetMC = ss1_mc;
    two_mc.targetMC = ss2_mc;
    three_mc.targetMC = ss3_mc;
    four_mc.targetMC = ss4_mc;
      
    function nextImage(e:MouseEvent):void
    {
      TransitionManager.start(currentImage, {type:Fade, direction:Transition.OUT, duration:3, easing:Strong.easeOut});
      currentImage = MovieClip(e.currentTarget);
      TransitionManager.start(currentImage.targetMC, {type:Fade, direction:Transition.IN, duration:3, easing:Strong.easeOut});
    }
    Any help would be greatly appreciated... thanks!
    Last edited by djsting; 04-05-2009 at 03:02 AM. Reason: added example code

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I am not sure you can do it this way. Make this change:
    Set the alpha of all images to 1 (ss2_mc.alpha = 0.
    - The right of the People to create Flash movies shall not be infringed. -

Tags for this Thread

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