Recipe 12.6. Adding Buttons to a Presentation Using Flash 8 Cookbook Components


Problem

You want to add next and previous buttons to a presentation made with the Presentation component.

Solution

If using the frames technique, add button instances named btNext and btPrevious.

If using the named movie clip technique, add another movie clip symbol with nested button instances named btNext and btPrevious.

Discussion

The Presentation component does not add next and previous buttons by default. Instead, it allows you to specify whether you want them, what they should look like, and how they should be placed relative to the contents of the presentation. However, should you opt for adding next and previous buttons, you can do so without having to add any ActionScript code. How you can add the buttons varies slightly depending on which technique you have used to construct the presentation sequential frames or named movie clips (see Recipe 12.5 for more details).

If you have constructed your presentation using sequential frames, you can add next and previous buttons by adding a layer to the timeline in which the sequential frames have been placed, and adding the button instances to the layer. The key is that the button instances must have specific instance names. Using the Property inspector, you can give them instance names of btNext and btPrevious. The component will take care of the rest.

If you have used the named movie clip technique to construct your presentation, adding next and previous buttons is just slightly different. What you should do is create a new movie clip symbol and place the two button instances inside the movie clip symbol. Just as with the presentation content movie clips, the buttons' movie clip will be added programmatically and aligned similarly. So make sure that you place the buttons within the movie clip's coordinate space appropriately. Then, so that the component will be able to apply the correct actions, give the two nested button instances the instance names of btNext and btPrevious. The only remaining step is then to set the symbol to export and to give it a linkage identifier of Presentation-Buttons.




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net