flash tutorial flash 2.0

Upload: yugesh-baabho

Post on 03-Jun-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Flash Tutorial flash 2.0

    1/6

    TUTORIAL

    Page 1

    2.1 CONTROLLING THE MOVEMENT OF AN OBJECT USING ACTION

    SCRIPT

    Start new movie with File > New. Create a circle and name it as circle. Put the circle in

    the middle of the stage and make it a movieclip symbol.

    Select the circle and Open the Properties panel. Name the Instance as ball

    Create another layer in the timeline and name it as the action layer

    Make sure two frames are created on both layers

    Click on the 1stframe of the action layer and go to the action panel and type the following

    scripts;

    ball._x = _xmouse;

    Note: Ball is the Object , _x is the property (x co-ordinate) and _xmouse is the value.

    Click on the 2nd

    frame of the action layer and to the action panel and type the following

    scripts;

    gotoAndPlay (1);

    Note: The ball move horizontally according to the movements of the cursor.

    Question: How do you create an object that follows your cursor?

    2.2 STOPPING AND RESTARTING TIMELINE

    Create a new movie. Draw a circle and convert it into a movieclip called mcircle. Createa 40 frames tween animation on the circle from left to right.

    Later the mcircle will be named as ball.

  • 8/12/2019 Flash Tutorial flash 2.0

    2/6

    TUTORIAL

    Page 2

    Drag the symbol into layer1 inside scene1 which consist of 50 frames. Create another

    layer on top of layer1 and name it as action. On the frame 35 (press F6 for inserting

    keyframe) on the action layer go to action panel and type the following scripts;

    ball.stop();

    The go to frame 45 (press F6 for inserting keyframe) on the action layer go to actionpanel and type the following scripts;

    ball.play();

    Test the scene.

    Note: You will see a ball pause on its journey because it stopped between frame 35 and45.

    2.3 RUNNING A TIMELINE BACKWARDS

    Create a new movie. Draw a circle and convert it into a movieclip called circle. Create a

    40 frames tween animation on the circle from left to right. (The tweening is done inside

    the circle)

    Create a new movieclip called behavior of 25 frames. On the frame 24 (press F6 for

    inserting keyframe) name this frame as loop. Go to the action panel and type thefollowing script;

    _parent.prevFrame();

    On the frame 25 go to the action panel and type the following script;

    gotoAndPlay("loop");

    Then double click on the circle movieclip and create another new layer on top of layer1

    with 25 frames. Drag the Behavior movieclip in to new layer inside the circle movieclip.

  • 8/12/2019 Flash Tutorial flash 2.0

    3/6

    TUTORIAL

    Page 3

    Drag the circle movieclip into the scene and test it out.

    Note: You will see a ball moving from left to right and vice versa.

    2.4 ADDING AN ON MOUSE EVENT ACTION

    New > Movie. Add 3 layers in the timeline as actions, text and button. Go to Insert >Create New Symbol to create a new button name button. Draw a circle representing the

    button.

    All the layers should consist of 40 frames. Drag the button in the library into the Button

    Layer. In the actions and text layers Insert Blank Keyframe on frame 20. Click on the

    actions layer at frame 20 and go to the properties panel to name the frame as detect.

    Then on the frame 20 of the text later, type the text as Testing

    Add a keyframe in the actions layer at frame 35. On the action panel type the following

    script;

  • 8/12/2019 Flash Tutorial flash 2.0

    4/6

    TUTORIAL

    Page 4

    gotoAndStop (1);

    Finally add a stop (); action in frame 1 of the action layer.

    Click on the button and go to the action panel and type the following scripts;

    on (release) {

    gotoAndPlay ("detect");}

    Note: If the user clicks on the button the scripts will point to the detect frame where thetext testing will appear out.

    2.5 CREATING NAVIGATION BUTTONS

    Create a small button with different patterns for representing Up, Over, Down and Hit

    states. Name the symbol as button. Make it look like this:

    Place 3 buttons in a row on the stage. Name the scene as main

    Create a new movieclip called buttontext and add the word text using text tool at the

    position 0,0 using the Info Panel. Add 4 keyframes on the layer1. Create another layer

    called actions. Delete the 1stkeyframe of layer1. Add stop( ) script on all the keyframes

    inside layer1

    Name the blank keyframe on the actions layer as blank, about, products and contact (On

    the properties panel). On layer 1 frame 2, 3, 4 represent the about, product and contacttexts. Name the movieclip as text (instance name).

    Go to the main stage and place the buttontext movieclip below the first button. After

    placing it,

  • 8/12/2019 Flash Tutorial flash 2.0

    5/6

    TUTORIAL

    Page 5

    Click on the 1stbutton and go to the actions panel and type the following scripts;

    on (rollOver) {

    text.gotoAndStop ("about");

    }on (rollOut) {

    text.gotoAndStop ("blank");

    }on (release) {

    gotoAndStop ("about" ,1); //You need to create a scene call about.

    }

    Rename all text in the movieclip as ABOUT, PRODUCT and CONTACT.

    Note: When your cursor roll over the 1stbutton the movieclip (instance name) named

    text will go to about frame resulting the word ABOUT appears on the stage. Whenthe cursor roll out from the 1stbutton it will go to the blank frame. When you release

    the cursor, it will go to frame 1 of scene called about.

    Create a layer called action and add the stop () script on the main scene. Create another

    scene called product. Refer to the following;

    Complete the tutorial by creating scene for products. As for contact, use the followingscript to help you to send your email.

    getURL ("mailto:[email protected]");

  • 8/12/2019 Flash Tutorial flash 2.0

    6/6

    TUTORIAL

    Page 6

    (Sample Output)