Archive for August, 2009

The only script remaining is the one that needs to be placed on the first frame to prevent the movie from animating through all five frames when it starts:

stop();

This completes the presentation movie. Test the movie to make sure that it works. Look over all the scripts again to make sure that you understand what each one is doing.

A movie like this can be used for many things. For one, it can be the entire contents of a Web site. The main menu can link to frames that explain a company’s mission, services, and contacts. Or, it could be a personal home page with frames about the owner’s history, interests, and other bits of information.

The important thing to realize is that Flash is no longer just an animation tool to you. You now control the movement of the Flash movie and can make it do other things besides a plain linear animation.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

fun3e78xqv

Comments No Comments »

The script for the Next button is identical to the script used in the previous example:

on (release) {
nextFrame();
}

The script for the Back button is similar. It just uses the prevFrame command instead:

on (release) {
prevFrame();
}

The script for the Main Menu button is a simple one as well. It uses gotoAndStop to take the user back to the first frame:

on (release) {
gotoAndStop(”main menu”);
}

Make sure that you also label the first frame as “main menu”.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

The other three buttons use the same script but with different markers. They are Sales, Distribution, and Conclusion to match the names of the rest of the frames.

Create the other four key frames in the Frame Contents layer. Instead of using the simple “Frame X” titles as in the slideshow example, I used real-world titles: Marketing, Sales, Distribution, and Conclusion. This makes the example seem a little like a corporate presentation or Web site.

The buttons at the bottom of the slide in Figure 5.6 are actually placed on several frames. Each button has its own layer in the timeline. The Next button stretches across all but the last slide. The Back button stretches across all but the first slide. The Main Menu button stretches across all the slides. None of these buttons stretches back to the first frame of the movie, which is the main menu.

Create these three buttons and place them in their own layers stretched across the appropriate frames.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

The elements of the main menu are all in the Frame Contents layer, in a key frame that stretches across only the first frame of the movie. It includes a piece of text reading “Main Menu” and four buttons. The four buttons are actually one button in the library. I just dragged the button onto the work area four times. The buttons are just simple circles. Next to each button is a piece of text with the name of the slide that the button links to.

The script on each button uses the gotoAndStop command. Here is the script in the first button:

on (release) {
gotoAndPlay(”marketing”);
}

As you might guess, the first slide, which will be in the second frame of the movie, is labeled Marketing. I could have used gotoAndPlay(2); and avoided using labels at all, but labels make the code much easier to work with. For instance, suppose that we wanted to add more frames at the start of the movie. Then slide 1, the marketing slide, would no longer be located in Frame 2 of the movie. This means that you would have to go back and change this script. However, by using a name rather than a number, you can shift things around in your movie without having to update your scripts.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

You can see that the Next button is present on only the first three out of four slides, and the Back button is present only on the last three out of four slides. You can also see that the main menu screen precedes these slides.

The little flags in the Frame Contents layer of the timeline show that I have labeled the four slide frames. This means that we can refer to each slide by a name rather than a frame number.

Now, let’s build this movie. You can refer to the example movie on the CD-ROM named 05presentation.fla if you want.

Create a new movie, or start with the movie from the slideshow in the previous task.

The title of the movie is on a layer by itself. It is just a piece of text at the top, in this case “Presentation Example.”

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

Now let’s build a more complex presentation. We’ll start with the basic functionality of the slideshow example and build from there.

The first thing we will add is a Back button to match the Next button. We’ll also place these buttons only on frames where they apply. So there will be no Next button on the last slide and no Back button on the first slide.

The major advancement for this movie will be the addition of a main menu screen. This will be the new first frame of the movie, and it will have buttons that link to every other frame of the movie. This means that the user can start anywhere in the movie that he wants. If he wants to jump right to the third slide, then he can.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

Choose Control, Test Movie to see it in action. The movie starts at Frame 1 and then pauses. You can then click the Next button to advance to Frame 2. You can keep advancing until you get to Frame 4.

The movie will not advance past Frame 4 because the nextFrame command will simply do nothing if there are no more frames. You could have placed the Next button in every frame except the last one so that the button will not even appear there.

Next, we’ll build a much more complex presentation movie.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

Make sure that the button is placed on a layer so that it stretches across all four frames of the movie. Check the example movie if you are not sure how this should look.

Attach a script to the button. Make sure that you have the button and not the frame selected. The Actions panel should have the title Actions - Button at the top. Here is the script:

on (release) {
nextFrame();
}

Now, select the first frame of the movie. In Figure 5.4, you can see that one of the layers, Layer 1, has four separate key frames, and the other layer, Layer 2, has one key frame that stretches across all four frames. Select the first key frame in Layer 1 and open the Actions panel. Its title should now be Actions - Frame. Looking at the title of the script panel is a good way to confirm that you are writing a frame script, not attaching one to a movie clip. Place this simple script in the script panel:

stop();

This stops the movie from rapidly advancing from Frame 1 through Frame 4. We want it to stop at Frame 1 and await the user.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

A slideshow is a simple presentation where you have various screens, or slides, presented one after the other. This is similar to how a plain Flash movie would work, except that without scripts, the movie would continue rather quickly through these frames.

Instead, we’ll use scripts to pause the movie on each frame. To continue it, we will use buttons that allow the user to advance to the next frame whenever she wants.

Create a new Flash movie. Place four different pieces of text or graphic on the first four frames. The example movie 05slideshow.fla contains the words “Frame 1″ through “Frame 4″ and a different shape on each frame.

Taken From: Sams Teach Yourself Flash™ MX ActionScript in 24 Hours

Comments No Comments »

  • Partner links