Now open up your library (Ctrl+L). This will list all the symbols you have made.

9) Take the Movie clip named processor and put it in the layer called processor.
10) Take the Movie clip named green and put it into the layer called green square.
11) Now take the Movie clip named red and put it in to the layer called red square.
12) Next give the instances of the movie clips red and green names. To do this select the movie and
choose Modify> Instance. Keep it simple, name the movie clip red (instance name red) and the movie clip green (instance name green).
13) Click on the text tool icon and then click the text field modifier below the tool bar.
14) In the layer called status, drag the mouse across the work area to create a small text field box.
15) Now right click on the text field box, choose Properties and this window will appear.



16) Type in the word "status" in the Variable box and check the boxes corresponding to that of the picture above.
17) Next you will need to edit the Movie Clip named processor. So right click on the movie clip and choose Edit.



18) In layer 1 add another Keyframe so that there are 2 key frames.
19) Click on first frame and add the following collision code.

Here is the action script code.

Set Variable: "red_x" = GetProperty ("/red",_x)
 Set Variable: "red_y" = GetProperty ("/red",_y)
 Set Variable: "green_x" = GetProperty ("/green",_x)
 Set Variable: "green_y" = GetProperty ("/green",_y)
 Set Variable: "red_h" = GetProperty ("/red",_height)/2
 Set Variable: "green_h" = GetProperty ("/green",_height)/2
 Set Variable: "red_w" = GetProperty ("/red",_width)/2
 Set Variable: "green_w" = GetProperty ("/green",_width)/2
 Set Variable: "distance_x" = red_x-green_x
 Set Variable: "distance_y" = red_y-green_y
 Set Variable: "area" = (red_h+red_w)*(green_h+green_w)
 If (distance_x*distance_x+distance_y*distance_y<=area)
 Set Variable: "/:status" = "Collision Detected"
 Else
 Set Variable: "/:status" = "No Collision Detected"
 End If