Square Shapes

Time to start adding some true shapes!

Still keeping it simple, let's add squares to each side of our banner we are creating.

A) Begin as always by opening our html page and beginning our php code block.


B) Here is our line shape from before.

$myShape1=new SWFShape();

c) Next we must define our new shape and set it's line attributes.

$myShape2=new SWFShape();

D) Next we set the color to fill our shape with, we will cover gradient and complex fills in a future lesson, for now we just set the color. If you draw your shapes clockwise, use setRightFill, if you draw your shapes counter-clockwise, use setLeftFill.


E) Next, we draw the lines that make up our shape. In this case, the four sides of our square.


F) Now we define our movie as before.

$myMovie=new SWFMovie();

G) Next we add our previous line shapes.


H) And now we add our new instances of our square shape, moving one to the left side and one to the right.


I) And finally, save the movie, close off our php code block, and finish our html as usual.


<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" ID=objects WIDTH=460 HEIGHT=80> <PARAM NAME=movie VALUE="lesson3.swf"> <EMBED src="lesson3.swf" WIDTH=460 HEIGHT=80 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </EMBED>

Next lesson, we will add more complex shapes such as polygons, arcs, and circles.

Code summary for lesson 3: