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.
<html> 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.
$myShape2->setRightFill(0,255,0); E) Next, we draw the lines that make up our shape. In this case, the four sides of our square.
$myShape2->drawLine(50,0); F) Now we define our movie as before.
$myMovie=new SWFMovie(); G) Next we add our previous line shapes.
$firstLine=$myMovie->add($myShape1); H) And now we add our new instances of our square shape, moving one to the left side and one to the right.
$firstSquare=$myMovie->add($myShape2); I) And finally, save the movie, close off our php code block, and finish our html as usual.
$myMovie->save("lesson3.swf");
Code summary for lesson 3:
|