Nido Web Tutorials

ActionScript 2.0
ActionScript 3.0
Import Movie Clip from Library

1. Create a - Flash File(ActionScript 2.0)

2. Press Control and F8 or go to Insert - New Symbol...

3. Name the symbol myObject, and make sure the type is Movie Clip.

There are 3 types of symbols:
Movie Clip - This is so you can make even more states for your button, complex animations, and other nifty things.

Button - Inside the object are button states. Up (which is default), over (for mouse over), down (for if you click and hold on a button), and hit (the hit box area of the button).

Graphic - This is just lock the object, and makes it easy to drag from the library, which you can't do with grouped objects.

4. In the Linkage section of the Convert to Symbol window, make sure there is a check mark in the Export to ActionScript check box, then click Ok.

5. Click on the Oval Tool in the tool bar, and draw an oval on the stage.

6. Now go back to your main stage by clicking on Scene 1 or the blue arrow pointing left just above your stage.

7. Now go to your Actions tab, you can do this by pressing F9, or going to Window - Actions in your menu bar.

8. In your "Actions - Frame" tab, type the code:

_root.attachMovie("myObject", "myObj", 10);

myObject is the name of the item in the library you are importing to your stage. myObj is the name we are going to use with the version of it on the stage. 10 is what layer the object is on.

myObj._x = 100;

myObj like I said is the name of our item on the stage. This is telling your object set it's X value to 100, which means it will be 100 units to the right of the left edge of the SWF.

myObj._y = 100;

This is the same as the last, but of for the Y value, and the item will be 100 units down from the top edge of the SWF.

Complete Code:
_root.attachMovie("myObject", "myObj", 10);
myObj._x = 100;
myObj._y = 100;

9. Press Control and Enter. This will render your SWF to show you what your results are. You can also go to Control on your menu bar, then Test Movie to do the same thing.

This code works for buttons and movie clips in your library.

FLA File