additional flash tutorial 2

Upload: thina-garan

Post on 04-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Additional Flash Tutorial 2

    1/27

    1

    This tutorial will focus on the button symbol type, demonstrating more of the

    hierarchical style of Flash and also some more ActionScript. We will start be

    inserting a new symbol, which we will call SuperButton and give the Button

    behavior.

  • 7/30/2019 Additional Flash Tutorial 2

    2/27

    2

    Editing our button symbol, we can see that it has 4 frames, instead of the series

    of frames weve seen previously. The up frame is where we specify what this

    button should normally look like. The over frame is for the creation of a

    rollover look. The down frame is for a pressed look. The hit frame is not

    actually shown, but defines the clickable area of your button. If not hit frame is

    provided, the up frame defines the clickable area.

  • 7/30/2019 Additional Flash Tutorial 2

    3/27

    3

    Here we have drawn a green oval in the Up frame, and put text inside the oval.

  • 7/30/2019 Additional Flash Tutorial 2

    4/27

    4

    Returning to our main editor, we can drag this symbol from our library onto the

    stage. If we run our animation at this point, well see theres a green oval on our

    stage that displays the hand icon when our mouse is over it.

  • 7/30/2019 Additional Flash Tutorial 2

    5/27

    5

    Inserting a keyframe in the down frame will copy over our green oval and let us

    make any desired changes.

  • 7/30/2019 Additional Flash Tutorial 2

    6/27

    6

    Well change our ovals interior to red.

  • 7/30/2019 Additional Flash Tutorial 2

    7/27

    7

    Now running our animation gives us a green oval that turns red when we mouse

    over it, but still nothing happens when we click on it.

  • 7/30/2019 Additional Flash Tutorial 2

    8/27

    8

    We can get a basic graphical change when we click by adding a keyframe for

    Down. Weve done that here with a blue oval.

  • 7/30/2019 Additional Flash Tutorial 2

    9/27

    9

    Heres where the hierarchical nature of Flash comes in. We are going to

    animate our Over frame by making it into a symbol. Select everything in the

    layer (the red oval, its black border, and the text). Then right click and choose

    Convert to Symbol.

  • 7/30/2019 Additional Flash Tutorial 2

    10/27

    10

    Well use a movie clip, and name it something like

    SuperButtonOverAnimation.

  • 7/30/2019 Additional Flash Tutorial 2

    11/27

    11

    We then right click on our symbol and choose edit.

  • 7/30/2019 Additional Flash Tutorial 2

    12/27

    12

    Because we only want to apply a shape tween to the oval (not the text), can right

    click and choose Distribute to Layers. This automatically divides up things on

    the layer into their own layers.

  • 7/30/2019 Additional Flash Tutorial 2

    13/27

    13

    We can then insert keyframes in frame 12 to make a 1 second animation.

  • 7/30/2019 Additional Flash Tutorial 2

    14/27

    14

    Going to frame one, select our oval and change its color to green.

  • 7/30/2019 Additional Flash Tutorial 2

    15/27

    15

    Then select shape tween from the properties dialog.

  • 7/30/2019 Additional Flash Tutorial 2

    16/27

    16

    Yay, our button animates. But instead of going from green to red, it loops.

    Remember that all Flash animations loop by default.

  • 7/30/2019 Additional Flash Tutorial 2

    17/27

    17

    To make it stop, well add an actions layer. Well also delete that old layer that

    we distributed from, since its no longer being used (see how its outline is

    hollow, versus the grey outlines on layers with content).

  • 7/30/2019 Additional Flash Tutorial 2

    18/27

    18

    In our actions layer we create a keyframe in frame 12 and add this.stop( ).

  • 7/30/2019 Additional Flash Tutorial 2

    19/27

    19

    Up until now, all of our documents have had one scene. Documents can have

    multiple scenes, and will by default start one scene after the previous one ends.

    Scenes are essentially just another level of hierarchy.

  • 7/30/2019 Additional Flash Tutorial 2

    20/27

    20

    After inserting a scene, we can go to the movie explorer to move between

    scenes.

  • 7/30/2019 Additional Flash Tutorial 2

    21/27

    21

    Using the upper right corner menu, select Show All Scenes.

  • 7/30/2019 Additional Flash Tutorial 2

    22/27

    22

    We can move between Scene 1 and Scene 2 here.

  • 7/30/2019 Additional Flash Tutorial 2

    23/27

    23

    We will make Scene 2 just be 1 frame containing several ovals, but remember

    this scene could be as complex as you want.

  • 7/30/2019 Additional Flash Tutorial 2

    24/27

    24

    We then add ActionScript to make Scene 2 stop at Frame 1.

  • 7/30/2019 Additional Flash Tutorial 2

    25/27

    25

    We then use the movie explorer to get back to Scene 1.

  • 7/30/2019 Additional Flash Tutorial 2

    26/27

    26

    In scene 1, we add code to stop after frame 1.

  • 7/30/2019 Additional Flash Tutorial 2

    27/27

    The functionality we now want is for our superbutton to take us to scene 2 when

    it is pressed.

    To create an event for our button, select it and go to the actions dialog. Type

    on( to get a list of events. Well use press for this.

    When the button is pressed, we want to jump to Scene 2. The gotoAndPlay

    method will do this.