A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help! Movie Fade in onframe, play 5 sec., then fade out on frame

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    7

    Help! Movie Fade in onframe, play 5 sec., then fade out on frame

    Hey all...

    would it be possible to tell me how to do this effect.

    I have a movie instance named "sparkles_mov" as in internal movie, not loading externally.

    It's placed multiple times on the stage.

    I need an AS code for the first frame of the entire stage that makes all instances fade in at a specific frame number (5), last for XXX amount of seconds and then all of the instances to fade out at a specific frame number (70).

    Is this possible?

    I have all instances fading in using this AS code placed on the frame that they enter on but the fade out never works, the just abruptly disappear:


    Code:
    sparkles_mov._alpha = 0;
    fadeIn();
    
    function fadeIn(){
    this.onEnterFrame = function(){
    if(sparkles_mov._alpha <= 99){
    sparkles_mov._alpha += 5;
    }else{
    delete onEnterFrame;
    }
    }
    }
    }
    
    
    timer = setInterval(this, "fadeOut", 4000); //where 4000 is 4 seconds
    
    
    sparkles_mov._alpha = 0;
    fadeOut();
    
    function fadeOut(){
    this.onEnterFrame = function(){
    if(sparkles_mov._alpha >= 1){
    sparkles_mov._alpha -= 5;
    }else{
    delete onEnterFrame;
    clearInterval(timer);
    }
    }
    }
    }



    Thank you all muchly for any help here!

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    Shouldn't the second 'sparkles_mov._alpha' be 100 and not 0. That is why it is abruptly fading out.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  3. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    7
    i tried it, doesn't work. :-( in-fact, none of the fade functions work now. I've got something completely wrong in that code and I can't figure it out. :-(

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