Introduction to Flash and Actionscript

S5 addChild

 

Tutorial 1

Adding Text Using addChild

Formatting the Text

Adding Movie Clips using addChild

Create a new movie clip symbol and Export it for ActionScript. Delete it from the stage

 

 

 

Changing the Colour of Movie Clips

Tutorial #2 - Change Colour

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

 

Assignment #1 - Train

Create the image below using addchild. You may only use 4 movie clips.

 

Bonus ...... Create borders using code or additional objects.

 

 

 

 

Assignment # 2 (ICS3U )

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.

Hints:

-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

 

 

Assignment #2 - Modify Train (ICS3C)

(Note: You may choose to do the ICS3U assignment instead for Bonus Marks)

Add Buttons to your train assignment

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

Second click of the button should remove the added item.
Hint: use a variable to keep track of times clicked

Add a Title and a double border.

addChild to a new layer

var backgroundLayer:Sprite=new Sprite();
addChild(
backgroundLayer); // Do this at the beginning before adding any other children

backgroundLayer.addChild(myBack_mc); // Then addChild onto the background layer

Rubric