Introduction to Flash and Actionscript

S5 - AddChild


Tutorial 1

Adding Text Using addChild

Formatting the Text

Adding Movie Clips using addChild

Create 3 movie clip symbols, a Circle, a Star, and a Triangle. Delete the instances from the stage.




Tutorial #2 - Change Colour





Note: Buttons should be added using addChild


Note: Use only one button library symbol and modify color etc through code.


Now add a Button that removes the square

To remove a movieclip

Now on the other buttons if the movie clip does not exist you will have to add it back.




Assignment #1 - Train

Open your previous train assignment and save it under another name.
Delete all of you previous layers, do not delete your library symbols.

Create the image below using addchild. (Note: or the original image you created)

Add a formated text box with a Title

Add a border around the train


Modify Train

Add Buttons to your train assignment that do the following

1. Change the colour
2. Add a face in the window
3. Add a background (individual items or see layer info below)
4. Two additional buttons that modify the picture in some way.
5. Add Steam to the Stack using circles

Note: Second click of the button should remove the added item. (It will really be a different button)
Hint: Use different buttons that look the same - addchild and removechild to display the button that will do what you want

Add a Title beside/above/below each button


Assignment # 2 (Now Above and Beyond)

Create a "Choose a Shape" program. That allows the user to pick a shape and then the color of that shape and then displays the image in a box with a border and title.

Hint: Make the Shapes and Colours Buttons

Pick a Colour

Pick a Shape




Your Image

There are lots of different ways to do this. You can use one scene or multiple scenes.


-it is easier if you make them choose the color first

- create buttons for each color

- create buttons for each shape

- add eventlisteners for the color buttons only

- when they choose a color buttons

create movie clips for each shape

Now create event listeners for each color button and each shape button


Note: you will need to remove movie clips before placing a new one. Create a function called removeclips() that is called on every shape button. In the function have an if for each movie clip that will remove the clip if it currently exists on the stage (yes one if for each shape)

Or you could use a reset button that clears the current image before drawing a new one.

Formating Fonts