Flash Templates - Flash Design Templates - Flash Website Template

Go Ronald — Flash Tutorial Sound

Posted on September 5th, 2008 | No Comments »
Categories: Flash Industry News, Uncategorized

In this tutorial you will learn how to add sound to your Flash Movie. This tutorial explains how to Import sound files into your Flash movie and then looks at the two different ways in which Flash handles sound: Event and Streamed sound. There is an explanation of both sound types and practical instructions of how to use each of these in your Flash Movies.

 

 

Importing Sound into your Flash Movie

 

Common Library

Flash comes with a small Library of sounds that you can use. They are the type of sounds that you would attach to a button so that when the button is clicked you also hear a “click”. To access the sounds:

Go to: Window > Common Libraries > Sounds

This opens a panel with a list of sounds:


Common Sound Library

To Listen to the sounds:

  1. Select the sound name in the lower section.
  2. Click the play button in the top section.

There are a number of ways to get a sound from the common Library into your Movie.

  1. Open your own Library: Window > Library
  2. Move the Libraries so that they are one next to the other.
  3. Drag a file from the Common Library to your Movie Library


A sound file in the movie Library after it has been dragged from one library into the other.

Note: You cannot use the sound unless it is in your own movie Library.

Another way of getting a sound file into your movie is to drag it from the Common Library directly onto the Stage. Even though you drag onto the Stage you will find the sound in the time line!


A sound which has been dragged onto the Stage ends up in the TImeline.

Note: Once you dragged a sound onto the Stage you will find that it is in your own movie library. It will stay in your library even if you remove the sound from the timeline.

Importing an External Sound File
You cannot import any sound, it can only be certain file formats:

  • WAV (Windows only)
  • AIFF (Macintosh only)
  • MP3 (Windows or Macintosh)

If QuickTime 4 (or later) is installed on your system, you can also import these:

  • AIFF (Windows or Macintosh)
  • Sound Designer II (Macintosh only)
  • Sound Only QuickTime Movies (Windows or Macintosh)
  • Sun AU (Windows or Macintosh)
  • System 7 Sounds (Macintosh only)
  • WAV (Windows or Macintosh)

To import a sound file into Flash go to either:

File > Import or
File > Import to Library

Browse to where your file is located.
Select a file and click: Open

It does not matter which Import method you use as either way the file ends up in your library.

Event or Streamed Sound

Event
An event sound is one which plays to the end of the sound file no matter what else is happening in your Flash movie. That means that once it starts to play it cannot be turned off! For this reason event sounds are usually short. The most common use for an event sound is to attach it to a button. When you click the button it makes a sound - it”s a bit like a door bell except it is a button bell.

 

An event sound must be downloaded before it will play. This is important because sound files can be very large. This is another reason why event sounds tend to be short. Remember that once a particular sound has been used once, it can be used again and again without having to re-download. Therefore it is better (in download terms) to have a few sounds attached to many buttons than every button have it”s own unique sound.

 

If somebody clicks on a button that has a sound attached and the sound has not yet downloaded the button will still work. It will just be silent.

 

Streamed
Streamed sound does not need to be downloaded to play. It downloads and plays simultaneously. If you have sounds that are more than a few seconds long you should used streamed sound. The disadvantage is that on a slow Internet connection the sound/music may be of poor quality. You either have to make sure that the sound is not played until the entire file has downloaded or accept that the quality may not brilliant on all machines.

Cross Ref: One way to ensure that a sound file has completely downloaded is to use a preloader. See tutorial: Intermediate - Preloader

Steamed sound can also be switched on and off. All sounds go in the Timeline but a streamed sound can only be heard if the Timeline is being played. If you stop the movie from being played, the sound will stop. Also if you go to a different section of the movie, like a new scene, the sound will also stop playing.


Step One: Setting up the Document

  1. Go to: File > New
  2. Go to: Modify > Document
  3. Select a size for the Movie.
    Mine is: 95 x 35 pixels
  4. Go to: File > Import to Library
    Select the sound file that you want to use.
    If you have downloaded the sound file above import: Beg-021c__Sound.mp3

    Note: On some computers you will not see the file extension (.mp3) at the end of the file name.


Step Two: Creating the Streamed Sound

  1. In the Timeline re-name Layer 1 to: Audio
  2. Right click (Mac Ctrl click) on Frame 1 and from the menu select: Actions
  3. Go to: Plus > Actions > Movie Control > stop

    This will place the following ActionScript in frame 1:

        stop();

    This is to make sure that the sound file does not auto-play.

  4. Right click on frame 2 and select: Insert Blank Keyframe


    Audio Layer in the Timeline with Action and 2 blank Keyframes.

  5. If the Property Inspector is closed - open it: Window > Properties
  6. Click in Frame 2 to select it.
  7. In the Property Inspector select: Sound > Beg-021c__Sound.mp3
    Or what every your sound file is called.
  8. In the Property Inspector select: Sync > Stream


    The sound setting for frame 2.

    Note: The sound file starts in frame 2 so that when the movie first loads and when you press the stop button the movie will be totally silent.

  9. For streamed sound to play you need to have enough frames in the timeline.
    If you are using the sound file downloaded from this site, right click on frame 161 and select: Insert Frame
    If you are using a different sound file you will need to keep adding frames until the Timeline is long enough.


    You can see the end of the sound file when the horizontal line stops.


    The sound only starts in frame 2.


    The entire length of the Timeline.

    Tip: If you need to keep adding frames use the F5 key. If you have too many frames and need to remove some use: Shift F5


Step Three: The Control Buttons

We need three buttons for Play, Pause and Stop. There is no reason why you cannot create your own buttons, but for this tutorial I am going to use three buttons that are in the Common Library as it is quicker and easier.

  1. Create a new Layer by clicking on the Insert Layer button in the Timeline:

  2. Name the layer: Buttons

  3. Go to: Window > Common Libraries > Buttons

  4. Double click on the folder : Playback

  5. Drag on Stage the following buttons:


    Gel Right:
    Gel Pause:
    Gel Stop:

  6. Right Click (Mac: Ctrl click) on the Gel Right Button and select: Actions

  7. Click on the View Options button and select: Normal Mode

  8. Go to: Plus > Actions > Movie Control > Play

    Your ActionScript should look like this:

        on (release) {
            
    play();
        }

  9. Right Click on the Gel Pause Button and select: Actions

  10. Go to: Plus > Actions > Movie Control > Stop

    Your Action Script should look like this:

        on (release) {
            
    stop();
        }

  11. Right Click on the Gel Stop Button and select: Actions

  12. Go to: Plus > Actions > Movie Control > goto

  13. In the Options select the Radio button : Go to and Stop

    Your Action Script should look like this:

        on (release) {
            
    gotoAndStop(1);
        }

  14. Your movie should now be ready to rock and roll. Test your movie: Control > Test Movie

    Cross Ref: Sound files can make a Flash movie very large and means that the file maybe slow to download. To look at how you help keep your file sizes small, including sound compression see tutorial: Beginners - Optimizing a Flash Movie

 


Please indicate what you thought of this tutorial 
10 is the best: 
10 9 8 7 6 5 4 3 2 1

… Read More of this tutorial at WebWasp.co.uk Tutorials

Go Ronald — Flash and AS Tutorial - Object control

Posted on September 3rd, 2008 | No Comments »
Categories: Flash Industry News, Uncategorized

Learn this tutorial and see how to control any object, using a buttons and Action Script in flash 8 .



Step 1

Create a new flash document and set Width to 200, and height to 300px. After that, frame rate set to 16fps.



Step 2

Double click on layer1 to rename its name in background. Then, insert a new layer and name it button1.

Step 3

Take the Text Tool (T), set font, size and color which you like, and type somewhere on the top of  stage “Come here”. See the picture below.



Step 4

While your “text” is still selected, press F8 key (Convert to Symbol), to convert it into a Button.



Step 5

Then, select the button, open the Action Script Panel (F9), and paste this scritp:

on (rollOver) {
tellTarget (”/object”) {
gotoAndPlay(12);
}
}

Step 6

Insert a new layer and name it button2. Then, take the Text Tool (A), and type somewhere on the bottom of stage “Come here” again.



Step 7

While your “text” is still selected, press F8 key to convert it into a Button, like we have done for the first text.

Step 8

After that, select the button, open the Action Script Panel (F9), and paste this script:

on (rollOver) {
tellTarget (”/object”) {
gotoAndPlay(2);
}
}

Step 9

Insert a new layer and name it object.

Step 10

Draw any “shape” that would represent our “object”. For this example, I have drawn this:



Step 11

Select the “object”, and press F8 key, to convert it into a Movie Clip.



Step 12

Double click on a new made Movie Clip to go in its inside. After that, while your “object” is still selected, press again F8 key to convert the “object” into a Graphic Symbol.

Step 13

Then, set the object on the position where we have placed the first text (button), on the top of stage. See the picture below.



Step 14

Click on frame 12 , and after that on frame 24, and press F6. Then, go back on frame 12, and set the “object” on the position like it is shown on the picture below.



Step 15

Go back on frame 1, and frame 12, and in Properties Panel (Ctrl+F3), under Tween choose Motion.



Step 16

Insert a new layer and name it action.

Step 17

Click on frame 12 and 24, and press F6 key. Then, go back on frame 1, 12, and 24, and for every frame, open the Action Script Panel (F9), and paste this script:

stop();



Step 18

Go back on the main scene, select the “object”, open the Properties Panel (Ctrl+F3), and under type object.



We”re done!

Download source file (.fla)

As the web develops, Flash programming continues to be a dominate force for finding creative solutions for modern needs. Web 2.0, and demands for interactive social media marketing are becoming formidable in the internet world, and these needs require a savvy, visually stimulating form of media to communicate with users. Enter Flash and Action Script - the engine behind many of the most successful interactive websites on the internet. Most notably, Flash has served the online gaming community by providing players with the ability to play live casino games online without the need to download software. This innovation is a testament to the genius of flash: Strong Random number generation programming, catchy graphics, gaming algorithms, and realistic casino style play are successfully captured in a single flash movie file. Flash's benefits also cater to the sports betting side of the game as well. Many odds-making websites use Flash media to display interactive, up to the minute betting odds during the Fall football season for those who love NFL betting. This important time of year is big for online casinos as well: players placing bets on sports patronize casinos while waiting for the results of NFL betting contests to come in. Similarly, in the Winter and Spring, where basketball betting and online blackjack rage as customers flock to various gaming sites, Flash facilitates a wide variety of user interfaces that provide for realistic experiences, quick transactions, and superior visual stimulus. The future looks bright for flash applications in the sports betting world - lines, odds, and important action-script driven interfaces will be required to meet the needs of the gaming world.