Create A Simple Flash Presentation

Thursday, February 28, 2008 - 14:18

One common thing that can be done with Flash is to create presentations. These presentations can then be exported to a swf file and viewed by just about everybody.

To make a presentation create a new flash document and create a new layer. This layer will be used to keep the next and previous buttons in a consistent place.

On the first frame add the following code to stop the animation running at the first frame.

stop();

Next, create a button that you can use for moving forward and backward through the presentation. This can be done by drawing an object on the stage, right clicking on it and selecting Convert to Symbol.... You can then add these buttons to the stage and create events for them.

For the previous button a function exists in ActionScript called prevFrame(). So all you need to do is attach that function call to the release event (ie. after a user has clicked on it) on that button.

1
2
3
on(release){
  prevFrame();
}

The next button is much the same, except that it uses the function nextFrame().

1
2
3
on(release){
  nextFrame();
}

It is also possible to create a menu slide that will click through to some of the main frames in the presentation. To do this you can use the same button object that you have used before and use the following code to fast forward to a particular slide.

1
2
3
on(release){
  gotoAndStop(25);
}

This works if you don't add any more frames before that frame as it will change the number of the slide. A better way is to use frame labels, which can be set in the properties section for every key frame.

1
2
3
on(release){
  gotoAndStop("chapter3");
}

This will always move to the frame labelled chapter3, even if you add more frames before it.

The most recent version of Flash comes with the option of creating a presentation when you create a new file. This creates a project with some basic functionality. For example, pressing the left and right arrows on the keyboard will move the presentation through the slides.

Category: 
philipnorton42's picture

Philip Norton

Phil is the founder and administrator of #! code and is an IT professional working in the North West of the UK.
Google+ | Twitter

Add new comment