Let's begin our journey into Ming by creating a plain swf file, and placing it on a webpage so that most any browser can view it.
Lets create a swf movie with a red background and dimensions of 460x80 (close to a standard banner, and swf files scale beautifully). A) At WebWizardsWays, php can be placed directly in html documents, so begin with our normal html tags <html> <body> B) Next we use the php opening tag to begin our code: <?php C) Next, we create a new SWFMovie by creating an object set to the new movie: $myMovie=new SWFMovie(); D) Now we can set the attributes of the movie object we created, such as the size and background color (colors are in rgb): $myMovie->setDimension(460,80); $myMovie->setBackground(255,0,0); E) And finally we can save the swf we have created to a file, then close off the php code section: $myMovie->save("lesson1.swf"); ?> F) Now we use the standard flash object embed and param tags so that as many browsers as possible can view our creation: <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="lesson1.swf"> <EMBED src="lesson1.swf" WIDTH=460 HEIGHT=80 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </OBJECT> G) And finally close off the html page: </BODY> </html> Next lesson we will add various shapes to our newly created movie! |