Trials and tribulations with Flash Slide Presentations

Started as a rant, and ended up being a “How-To“!

I did a sales animation in Flash 8, and marketing asked that it be made into a loop for a booth in London at a show starting the next day. I
had an hour to modify it. Well, it turns out that no Flash 8 book talks about slides, let alone the code. I won’t list the books, but I have
them all, including the OOP work by Elst & Yard. And please don’t tell me that actionscript has nothing to do with slides and slide control. controlling slides is as important as controlling movie clips.

The original sales animation was manual. aside from the problem of delaying text for a booth animation, I had to figure out how to make
the slides transition as well as go back to the top/front at the end of the last slide. You can’t do this in any other way than
actionscript-but you won’t find much on it. Add to this the fact that the solution was painful to discover, as there is a needed
inconsistency in syntax styles in order to make the running app respond to the code. You’ll see what I mean in a sec.
At frame 1 of each slide (not the master/parent), in a keyframe put:

_root.Background._currentSlide.gotoAndPlay(1);

At the end of each slide, in a keyframe, put:

_root.Background._currentSlide.gotoAndStop(1);
this.currentSlide.gotoNextSlide();

And at the end of the last slide, put this in a keyframe:

_root.Background._currentSlide.gotoAndStop(1);
_root.Background.gotoFirstSlide();

Note: “Background” just happens to be the background/master slide’s name.

Why “gotoAndPlay(1)?”, you say? Because on subsequent passes, the playhead needs to know to start playing the slide (really a movie). Without this, your slides will reset due to “gotoAndStop(1)”, but will just sit there. The playhead will not advance, and your booth loop will
stop on the second pass.

Now you say, “Why the gotoAndStop(1)?”… Well, there is an interesting “condition” of slides that I think is proper for sales presentations. Once you open/traverse/start a particular slide, it plays. It also _continues_ to play after you leave the slide and move on/back. I say proper because in the manual, original, intended mode, you want to go back to a previous slide and show the prospect/customer the final position of the animation, not make them sit through it all over again.

What does this mean to the booth animation? Well, it means that all passes _after_ the first pass will see the slide in an unpredictable
frame, and playing. Ideally, you want the slide to “reset” after it is told to move to the next slide. This way, the next pass gets the slide
in a predictable location.

The syntax required is exactly as I posted above. If you don’t believe me, try changing it. This was very, very frustrating for several reasons: I had no time to play around, no references to slides (in any form) in any actionscript references, and the syntax required was mixed. As a bonus, I add 4 buttons that goto previous slide, goto next slide, pause/play the current slide and restart the current slide. This is in the manual version, and I “guideify” the layers with these buttons in the booth loop.

For previous slide button:

Remember, we’re shooting for powerpoint style behavior, as we give these animations to sales/marketing as .exe projectors. The next slide button’s actions:

Now for the replay/restart button. I did this with a button component:

The code should be in the master, toward the top with all the other actionscript. Remember, “Background” is the master slide’s name. Now for the more fun pause/play button:

The fact that the button’s text changes according to the condition of the switch is a nice touch, and avoids making separate “pause” and “play” buttons. As you’ve guessed, on the stage the pause button is called “Pause”, and the replay/restart (current slide) is called “Replay”. Remember our back/forward buttons from above? They are called “backBtn” and “forwardBtn” on the stage. So here is how you make sure that when at the first slide the “previous” button isn’t available:

Put this in your master on frame 1 on some layer:

Pretty cool, eh? “revealChild” kicks off each time a (child) slide loads. Oh, and while I’m spilling my guts, here is the way you fade the slides so they have a nice transition instead of being a harsh, fast snap to the next slide. On each child slide, put this code in the actionscript window that comes up when you click the slide on the left list. There is no frame for this code, and there is no clue it exists in the slide’s layers. Just click the slide on the left, and paste the following into each child slide that you want to fade to/from:

“reveal” and “hide” are actions that a slide has, so you won’t put it into a particular frame or layer in the slide’s movie. And while we’re at it, I may as well add the standard stuff we always put at the master slide, or start of any sales animation:

There you go. I hope this helps a Sales Engineer get out of the kind of trouble I was in last night. Also, I ended up putting all the tricks I use in an animation into a single post. Sorry if some of you find that tedious, but it is a lot easier to find something in one post than several.

Don’t do things the hard way! Code lazy!

Leave a Reply

Your email address will not be published. Required fields are marked *