Your Ad Here

August 21, 2010

Import Movie Clip from Library to Stage

Reactions: 
Title: Import Movie Clip from library onto the stage using Action Script

Category : Intermediate
Actionscript : 2.0

Here you will learn to import a Movie Clip from library onto the stage using Action Script in Macromedia Flash.

1- Open Macromedia Flash and create a New Document.
2- Create a new Movie Clip (Ctrl + F8) > Select Movie Clip > Click the Advance Button.






3- In the Identifier box write "ball_mc". Tick the option 'Export for Actionscript'. Press OK.















4- Draw any shape you want like here we have drawn a simple ball.






5- Now go back to 'Scene 1'
6- Select the first frame and open up the Actions Panel (F9).
7- Write the actions as follows:
stop();
attachMovie("ball_mc", "ball_mc", 1);

8- Its Done. Check the movie clip by pressing Ctrl+Enter.
9- You can additionationally add some more script to get your movie clip in the right positon and size. Add this to Actionscript:
ball_mc._width = 300;
ball_mc._height = 300;
ball_mc._x = 10;
ball_mc._y = 10;

10- All Done.

Description:
>This will stop the current movie on frame 1
stop();
>This will attach the movie clip to the stage
attachMovie("ball_mc", "ball_mc", 1);
>This will set the width and height of the MovieClip
ball_mc._width = 300;
ball_mc._height = 300;
>This will set the x and y position of the MovieClip
ball_mc._x = 10;
ball_mc._y = 10;

1 comment:

  1. thanks for this but i tried something like this

    if(listBox.getSelectedItem().data["author"]
    =="St. Paul University Phil.")
    {

    trace("Your in St. Paul University Phil.");

    _root.movieclipname_mc.gotoAndStop(6);

    }

    and when i run it nothing happens...i hope you can help with my problem...thanks im a newbie in flash

    ReplyDelete

Please use sensible language.....!