hockeyb47
05-18-2008, 12:13 AM
I'm working on a project for English, and the task is to create a slideshow. I coded it in ActionScript 2.0 and everything works fine, up until it reaches about a dozen images. The program starts to lag, so I decided to just kill off a movie clip after a few images.
Here's a quick rundown:
First, we load the XML file containing the image URLs. Easy enough.
Second, we start the timer that counts down 10 seconds to each slide. This timer will trigger an imageSwap event.
Third, an imageHandler clip hears this event and responds by setting the next URL, then fires off an imageReady event.
Fourth, an imagePlayer clip hears THIS event and responds by creating a new image and animating it in. It creates a new movie clip with
var pic = createEmptyMovieClip("pic"+nextDepth,nextDepth);
then loads the image into it. Then it animates a falling photograph.
So that's where I need help. I need to get the new clip to disappear after a while. I tried something like:
clip.onEnterFrame = function() { //code to disappear after a few slides }
but to no avail. I know it's the function that's not happening, because I always put traces in my maybe-bad functions.
I was also thinking about letting imagePlayer decrement the alpha each time it made a new clip, then use removeMovieClip(theClip) when a clip's alpha reaches 0. But how would I go about doing that without O(N) complexity every time?
Thanks for any help in advance.
Here's a quick rundown:
First, we load the XML file containing the image URLs. Easy enough.
Second, we start the timer that counts down 10 seconds to each slide. This timer will trigger an imageSwap event.
Third, an imageHandler clip hears this event and responds by setting the next URL, then fires off an imageReady event.
Fourth, an imagePlayer clip hears THIS event and responds by creating a new image and animating it in. It creates a new movie clip with
var pic = createEmptyMovieClip("pic"+nextDepth,nextDepth);
then loads the image into it. Then it animates a falling photograph.
So that's where I need help. I need to get the new clip to disappear after a while. I tried something like:
clip.onEnterFrame = function() { //code to disappear after a few slides }
but to no avail. I know it's the function that's not happening, because I always put traces in my maybe-bad functions.
I was also thinking about letting imagePlayer decrement the alpha each time it made a new clip, then use removeMovieClip(theClip) when a clip's alpha reaches 0. But how would I go about doing that without O(N) complexity every time?
Thanks for any help in advance.