Getting started/Create Background

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. Name your new file with a php extension.

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 can link the swf to the Ruffle flash player using the following code on a separate HTML page, so it can be viewed in most browsers.

<!DOCTYPE html>
<html>
<head>
<body width="460" height="80" background="#999999"><

src="lesson1.swf"
width="460"
height="80"
type="application/x-shockwave-flash">
</body>
</html>


Next lesson we will add various shapes to our newly created movie!


Code summary for lesson 1:



Result: