Solved

Flash Fade Image with setInterval

Posted on 2004-10-22
333 Views
Last Modified: 2008-02-26
Having difficulty fading image.  setInterval does not appear to be working.  The fade stops at 75.

// SHOW RANDOM IMAGES
images = new Array();
path = "http://www.bristolhillsoutfitters.com/pics/";
for (i=0; i<4; i++) {
 images[i] = path+"deer"+i+".jpg";

}
function fadeImage() {
 if (_root.imageHolder_mc._alpha>10) {
  _root.imageHolder_mc._alpha -= 25;
  trace(_root.imageHolder_mc._alpha);
 }
}
function imageLoader() {
 imageNo = random(3);
 _root.createEmptyMovieClip("imageHolder_mc", 200);
 _root.imageHolder_mc.loadMovie(images[imageNo]);
 setInterval(fadeImage(), 5000);
}
imageLoader();

Thanks!

Terry
0
Question by:splendorx
    3 Comments
     
    LVL 6

    Accepted Solution

    by:
    Hi splendorx,

    Use it like this:
    setInterval(fadeImage, 5000); // without brackets

    And 5 seconds is too much for smooth fade, try something smaller, like 500.
    0
     
    LVL 1

    Author Comment

    by:splendorx
    thanks!!  works great!
    0
     
    LVL 6

    Expert Comment

    by:hsmtp
    You're welcome! Don't forget to click button "Accept Answer" :)
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
    This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

    845 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    5 Experts available now in Live!

    Get 1:1 Help Now