Adding text in lesson 5 was fun, and allows us to communicate with many styles and colors, but that's not the limit of Ming and text!
You can add borders and fills to your text, creating the appearance of shape masks and/or adding to the beauty of your written words!
Let's make some words with borders and fill them with our rainbow gradient. No reason to keep adding to the complexity of these lessons, instead let's make this without all the extra shapes, and then see what everyone can do to customize it themselves!
A) Begin as always by opening our html page and begining our php code block
B) Now let's define our gradient fill like in the lesson 6
C) Next, we need to set a variable to the characters we want to use, you'll see why in a momment
$myString="Bordered & Filled!";
D) To border and fill characters, we need to define them as shapes
E) Next, we define the font to be used, block fonts work best for filled characters
F) Now define our gradient fill so we can add it to our shape and scale/move it to suit our designs (experiment according to the gradient/font used)
G) Now we can define our shape's fill and line style $myGlyphs->setRightFill($myFill1);
H) We need to keep track of the size of our textual shapes, so let's define some variables for easy reference when needed.
G) Unlike the Ming text function, the drawGlyph function draws one character at a time. So we need to use a loop to go through each character in the variable we set earlier.
[Note-if you are new to loops, you should check out the php manual to get a basic understanding of them http://www.php.net/manual/en].
Initialize our loop to the length of our variable
Move our drawing pen over to start the next character.
Keep track of our dimensions by adding the width of each charater to our variables
End the loop
If the loop gives you trouble, cc&p this code to use for now, and experiment with copies of it till you get a feelign for it.
H) Now we define our movie as usual, this time using our size variables for the dimensions
I) Next we add our bordered character shapes to the movie by creating our instance as usual, moving it into place according to our size variables.
J) Next, we save our movie as usual.
K) This is new for you in these lessons, you can use php to print out your flash coding, setting the dimensions according to any variables that contain the size in your coding
print '<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=$totalWidth HEIGHT=$myHeight>
<PARAM NAME=movie VALUE="lesson7.swf">
<EMBED src="lesson7.swf" WIDTH=$totalWidth HEIGHT=$myHeight TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
L) Finally, we close our php code block and our html document as usual
Don't forget, you can use radial gradients as well as the linear gradient used in this lesson's example!
Next lesson, we will learn how to move, that's right I finally said it, move things around using frame by frame animation.
Code Summary for Lesson 7: