The only thing I can add to this lesson is that on the following line:
$myShape1->setLine(5,0,0,255);
The variable "$myShape1" can be named anything of your choosing. You can easily call it $BlueLine, and replace every instance of $myShape1 with $BlueLine. The dollar sign must precede the variable name. The numbers that appear in the parentheses are the line thickness, and the last 3 numbers are the color (red, green, blue). If you need to draw other lines of different colors, you will have to declare a variable for each color you want to use.
Also, where the script uses "$firstLine" and "secondLine", these can also be named whatever you choose, such as "$TopLine" and "$BottomLine".
For clarification on the numbers in parentheses in the line below, the 440 is the length of the horizontal line, while 0 nulls out any other direction of the line.
$myShape1->drawLine(440,0);
For those who are familiar with php scripting, you can write a function to draw lines in Ming. You can place the following function in your movie and use it over and over to draw lines.
function hline($sz,$w,$r,$g,$b,$a){
$s = new SWFShape();
$s->setLine($sz,$r,$g,$b,$a);
$s->drawLine($w,0);
return $s;
}
Once the function is in the script, then you can call it with the following codes:
$horizontalline-$myMovie->(hline(size,length,red,green,blue,alpha));
$horizontalline->moveTo(x,y);
Where $horizontalline can be any name you choose, size is the thickness, length is the length, red, green, blue and alpha (0-255) are the colors plus transparency. Within the placement code or the moveTo line, x and y are the pixel location of the starting point of the line within the movie.
Similarly, there are functions that can be used for vertical or diagonal lines.
VERTICAL LINE
function vline($sz,$w,$r,$g,$b,$a){
$s = new SWFShape();
$s->setLine($sz,$r,$g,$b,$a);
$s->drawLine(0,$w);
return $s;
}
$verticalline-$myMovie->(vline(size,length,red,green,blue,alpha));
$verticalline->moveTo(x,y);
DIAGONAL LINE
function dline($sz,$r,$g,$b,$a,$x,$y){
$s = new SWFShape();
$s->setLine($sz,$r,$g,$b,$a);
$s->movePen(0,$y);
$s->drawLineTo($x,$y-$y);
return $s;
}
$diagonalline=$myMovie->add(dline(linesize,red,green,blue,alpha,length,y-pixel));
$diagonalline->moveTo(x,y);
|