Adding Shapes/Lines

Let's continue our journey into Ming by learning it's most important feature, the SWFShape(), and how it is used to create just about everything in your movie.

Keeping it to the basics, let's try drawing a line, then placing that line on our movie twice, once at the top and once at the bottom.

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


B) Next, we must define our line as a SWFShape(). Defining our shapes first allows them to be used over and over without drawing them again and again.

$myShape1=new SWFShape();

C) Next, we set the line width and color for our shape.


D) Next, we draw the line(s) for our shape.


E) Next, we create our SWFMovie as usuall and define it to our needs, in this case we are using the same definitions as Lesson1.

$myMovie=new SWFMovie();

F) Now, we can add our shape to the movie by creating an "instance" of it. You can create as many instances of a shape as you like once it has been defined. Just remember to give each instance a unique name in order to manipulate them later. Here, we add a line and place it near the top.


Here, we add another line and place it near the bottom.


G) Next, we save our movie, and close off our php code block as normal.


H) Finally, we add our swf file's html coding, and close our html document as normal.

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=",0,0,0" ID=objects WIDTH=460 HEIGHT=80>
<PARAM NAME=movie VALUE="lesson2.swf">
<EMBED src="lesson2.swf" WIDTH=460 HEIGHT=80 TYPE="application/x-shockwave-flash" PLUGINSPAGE="">

Next lesson we will add more complex shapes and learn to fill them with colors.

Code summary for lesson 2: