Using Actions to Control Your Movie
Top  Previous  Next



This is a step-by-step tutorial on how to add Actions to your SWiSH Movie. This tutorial is saved as "Actions.swi" in the File | Samples | Tutorials Menu.

1.Open "first.swi" from the File | Samples | Tutorials Menu  
 
2.On the 'Outline' Panel, select Scene_1, click on the (-) symbol next it to close the Scene, and copy to the Clipboard by holding down the Control while pressing the C key (Ctrl+C) on your keyboard  
 
actionsnew_copyscene1

3.   Select File | New and close "first.swi" without saving changes. Adjust your new Movie stage size to match "first.swi" by selecting the Movie Panel and changing the Width to 700, Height to 450

4.   In the new Movie, delete the default Scene_1 from the Outline panel. Paste in Scene_1 from the Clipboard by selecting Edit | Paste from the Main Menu or CTRL+V on your keyboard. This should only leave one instance of Scene_1 displayed with a (+) next to it as shown in the image below.


actionsnew_pastescene1

5.   Add a new Text Object by pressing the 'Insert Text' button or by selecting Insert | Text from the Main Menu. Change the size to 36, and change the text to read "Go to Swishzone"

actions_new_text_object
 
6. On the 'Timeline' Panel click on Frame 123 in the Timeline row labeled 'Go to Swishzone'. Press the addeffect 'Add Effect' button and add a Place Effect.
 
actionsnew_placeeffect1
 
You will notice that a Place Effect marker actions_place_effect_marker is now visible at Frame 123  
 
actionsnew_placeeffect2


7.Select the 'Timeline' Panel tab and select Frame 10 in the row labeled Scene_1 ('Scene' is always the top row in the Timeline). The 'Add Effect' button should now be replaced with an 'Add Script' button. Press the 'Add Script' button and select Movie Control | Stop  
 
actionsnew_stopaction1
 
Note: If the 'Add Script' button does not appear - make sure you have selected a frame from the row just below the ruler indicating the frame numbers.

   The Timeline should now look like this:

actionsnew_stopaction2

Note: When you move your mouse over the Action marker you should see a ToolTip indicating the Stop Action
 

8.   Now select the "THIS" Text Object from the 'Outline Panel' then click on the Script Panel to open it

9.   Press the 'Add Script' button and choose Events | Button | On Release from the Menu.

actions_add_onrelease

The 'Script Panel' should look like this

actions_add_action

10.   Press 'Add Script' again and select Movie Control | Play from the menu

actions_add_action_play

The 'Script Panel' should now look like this:

actions_add_onrelease_play

11.   Press playmovie Play on the Control Toolbar. The THIS Text Object will fade in and grow onto the screen, then the Movie will stop because of the Stop Action at Frame 10. Now move your mouse over the THIS Text Object and click and release the mouse button. When the mouse is released the Movie continues playing because of the Play Action that is triggered On Release. Press stopmovie Stop on the Toolbar

12.   Now go back to the Timeline Panel and select Frame 125 in the row labeled Scene_1

13.   Press the 'Add Script' button and select Movie Control | Stop from the menu.
The 'Script' panel should now look something like this:  

actionsnew_stopaction4


14.   On the 'Timeline' Panel, select the "Go to Swishzone" Object and click on the Script Panel

15.   Press the 'Add Script' button and select Events | Button | OnPress from the menu

16.   Press the 'Add Script' button again and select Movie Control | gotoAndPlay | gotoAndPlay(FRAME) from the menu. You should now see the Goto Frame Properties on the Script Panel

17.   The current Scene and Frame Number 1 are selected by default in the Goto Frame properties.

The 'Script Panel' should now look like this:

actions_add_action_goto_0

Note: The 'gotoAndPlay' dialog box will default to Frame 1 of the current Scene. If you wish to direct the Play Head to a different Frame or Scene, enter the Frame number and use the Target drop-down menu to select a different Scene.


18.   Press the 'Add Script' button again and select Browser/Network | getURL from the menu. You should now see the getURL properties on the right side of the 'Script' Panel

19.   Enter "http://www.swishzone.com" into the URL text box and select "_blank" from the Target drop-down menu (using "_blank" will open a new browser window).

The 'Script Panel' should now look like this:

actionsnew_gotourl1

20.   You will be able to test most of your Actions by pressing playmovie Play on the Control Toolbar. The "THIS" Text Object will fade in and grow onto the screen, then the Movie will stop. Click and release the mouse button over this Object. The Movie will continue playing and run the rest of your animation until "Go to Swishzone" appears and then it will stop. Now move the mouse over the Go to Swishzone Object and press the mouse button. The Movie will restart at Frame 0

21. To test the getURL Action, select File | Test | In Browser. Your default browser will open and your Movie will start and then stop when it reaches the first Stop Action you applied at Frame 10, click on the THIS Object to carry on playing your Movie. When it reaches "Go to Swishzone" it will stop (at the Stop Action you applied at Frame 122). Click on the Go to Swishzone Object. Your Movie will go back to the start and, at the same time, a new browser window is launched to display the URL http://www.swishzone.com

Note: You can use the Tools Menu | Preferences | Player and select the option at the bottom to launch a browser when testing the getURL action from within SWiSHmax. Otherwise, you can use Test in Browser/Player.

22. You will have noticed that there are other Actions already applied in this Scene. On the Scene line on the 'Timeline' Panel, select the Script marker in Frame 110, hold down the CTRL key while you also select the marker in Frame 111 and then press the Delete key on your keyboard

actionsnew_deletesound1


23. On the Timeline in the Scene line, double-click on the Script marker on Frame 2 (the playSound action). This will open the 'Script' Panel where you can then select Play Sound to open the 'Import' dialog box

Your 'Script' Panel should look like this:

actionsnew_playsound1


24. Import a wave (.wav) file from your system and you will find that it is automatically added to the Play Sound Action list at the bottom of the Script panel. By double-clicking on the sound in the Content list or by pressing the 'Properties' button you will open the 'Properties' dialog box, where you can change the type and level of compression and the Preload options.

actionsnew_soundoptions
 
By pressing the 'Sound Effect' button in the Content list at the bottom of the Script panel, you can change the number of times the audio file will be played, add effects such as Pan Left/Right, and set the volume level of the audio file.  
 
actionsnew_soundoptions2
 
Note: Selecting either "Fade In" or "Fade Out" from the Sound Effect drop-down menu will fade the sound across the total number of loops set. The 'Fade in first loop" and "Fade out last loop" options will fade the sound across only one loop of the audio (the rest of the loops will play at full volume).

25.Select File | Test in Player to test your Movie  
 
26.Save your Movie