You can download these instructions if you wish: (right click and “Save Link As”) Flash Exercise 2
CODE SNIPPETS (explained later):
At the end of your animation: (below)
stop();
At the beginning of your animation: (below)
import flash.events.MouseEvent; function onClick(event:MouseEvent):void { gotoAndPlay(1); } replay_btn.addEventListener(MouseEvent.CLICK, onClick);
<Instance Name>: replay_btn
Exercise 2 Instructions:
Create a new file, Action Script 3, 650 x 500
Save it in your Drive or DropBox folder with your lastnamefirstinitial_ex2
Change stage colour
Choose the Oval tool. Choose a stroke and fill colour that is different from the default. Make the stroke bigger. Draw a PERFECT CIRCLE (hold shift).
Choose the text tool. Use an interesting, lively font and an appropriate size and colour.
Write your initials inside of the circle.
Group the text and the shape together.
Use the Align panel to position your shape in the bottom left corner.
Change the drawing into a symbol
Right click on the object and choose Create Motion Tween
Place the playhead on frame 24
Move the symbol so that it is aligned in the bottom right corner
Place the playhead on frame 12
Move the symbol so that it is aligned in the middle of the stage and against the top
Go to the Control menu and choose Test Movie
To stop the animation from looping:
Create a new layer. Call this Action.
Choose frame 24 on the action layer.
Open the Action panel
Insert a Key Frame
Enter the text: stop();
Go to the control menu and test movie
To replay the animation:
Create a new layer. Call it Button.
Open the Components panel.
Under User Interface, drag a button onto the screen.
Make sure the button is selected on the stage. Open the Properties panel. Change the name of this to replay_btn
Still in Properties, look for Component Parameters. Change the label to “Replay” (or other text.)
On the Actions layer, put the playhead in frame 1.
Go to Actions panel. Paste in this code snippet:
import flash.events.MouseEvent; function onClick(event:MouseEvent):void { gotoAndPlay(1); } replay_btn.addEventListener(MouseEvent.CLICK, onClick);
Go to control and test movie.
Go to File menu and look at Publish settings.
Make sure that Flash and HTML are turned on, the rest off
Publish animation.
To view, open the HTML file in your browser