Practise 3
Add a picture
Swish allows you to import several pictures files format like .JPG, .GIF, .PNG, .BMP.
- We’ll work on a New Scene.
- Click on Insert > Scene to add a New Scene. You can see it in the Outline panel. If you want to come back to your first Scene, you just have to click on it in this panel.
Click on the shortcut Insert Image and choose your picture.
- Your picture appears on the center of your stage, you can change its position in the Transform panel.
Create an effect on a picture
By the same way as you've created an effect on a text, you can create an effect on your picture.
- Select your picture and click on Add Effect.
- Choose the effect you want and apply it.
- Don't forget to put a stop() action at the end of the effect
Create a button
- Come back to the Scene_1.
- Insert a New Text .
- Place this text in bottom-right corner of your stage.
- Select your text and click on Modify > Convert > Convert to Button.
- In the Outline panel, you can see the 4 states of this button :
- Up : State when the button is not used
- Over : State when the cursor is on the button.
- Down : State when you click on the button.
- Hit state : The clickable zone of the button.
- Put a different color for the Over state and Down state.
- Select the Hit state and, on your stage, draw a rectangle over your button. This rectangle will not be displayed but it will be the 'clickable area'.
Add an action to your button
- Select the button in the Outline panel and click on Add Script in the Script panel.
- Select Events > Button > on(press).
- Click again on Add Script and choose Movie Control > gotoAndPlay > gotoAndPlay(FRAME)
- In the Target menu select Scene_2, and enter the number of the Frame you want to go to ( here: 1)
- Play your animation and test your button. You 'll see that when you click on the button, the movie will go to the frame where the picture is and play the animation!
Add a sound to your button
- In the Outline panel, select your button (select the whole button, not just a state!)
- In the Script panel, select your first action and click on Add Script.
- Select Sound > playSound(...)
- At the bottom of the panel, click on Import... and choose your sound.
- Your audio file appears now in the right. You have to select it to insert it into the script!
- Test your animation.