Introduction to Flash and Actionscript
S5 - AddChild
Text Using addChild
Adding Text Using addChild
Formatting the Text
Movie Clips using addChild
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
your previous train assignment and save it under another name.
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
Add Buttons to your train assignment that do the following
1. Change the colour
Note: Second click of the button should remove the
added item. (It will really be a different button)
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
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.