A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to add a pause before actionscript fade in??

  1. #1
    Member
    Join Date
    May 2003
    Posts
    95

    How to add a pause before actionscript fade in??

    Hello,

    I have a picture that I want to fade in when the website launches, but I wanted it to appear after the menu appears. How can I delay the picture, via actionscript, from appearing?

    Right now my fade-in code is:

    Code:
    onClipEvent (enterFrame)
    {
            if (this._alpha >= 0)
            {
                    diff = +10;
            }
          this._alpha += diff;
    }
    Thanks!

    EDIT TO THIS QUESTION:
    Well, my fade-in code is somewhat messed up. If I try to fade-in a picture using this code, the code will reset after a minute or so! Do you know how I can stop that??
    Last edited by sirenetta1; 05-01-2005 at 09:45 PM.

  2. #2
    For your reset problem, I propose the following theory. Going from the code above, every frame, the alpha value is increased by some positive value. Even though alpha makes no sense outside the range of [0,100], the value continues to increase. Due to the computer's finite nature, the value of alpha will be come so large that it will go back to 0 (or a negative number) at which point it continues to increase, threrby giving a visual effect of a fade-in to 100 for a while then snapping to alpha = 0 and fading in again.

    Anyway, what I'm really getting at is that you just add this one line of code.
    PHP Code:
    onClipEvent (enterFrame)
    {
            if(
    this._alpha 100)
            {
                    if (
    this._alpha >= 0)
                    {
                            
    diff = +10;
                    }
                  
    this._alpha += diff;
            }


  3. #3
    Member
    Join Date
    May 2003
    Posts
    95
    Hey thanks, that looked like it solved the problem! Hmm.. so how could I some time in front of it before it begins??

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