Tuesday, 27 March 2012

How to Make Your swf Resize to Fit The Browser Window Automatically

If you want your swf to be as big as it can be in the browser window, and to resize automatically fit the user resizes the browser window:

Change the width and height values to 100%, and the scale to "default".

e.g.

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%" id="oxphos" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="oxphos.swf" />
<param name="loop" value="false" />
<param name="menu" value="false" />
<param name="quality" value="high" /> 
<param name="scale" value="default" />
<param name="bgcolor" value="#ffffff" />
<embed src="oxphos.swf" loop="false" menu="false" quality="high" scale="default" bgcolor="#ffffff" width="100%" height="100%" name="oxphos" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
 </object>

Obviously, if you have the script included, then you will need to change the values there too.

By the same token, you could set the swf to fill up most, but not all of the screen, by setting width and height to 80%, for example.

Thursday, 22 March 2012

How to Create a MySQL Database if it Doesn't Exist - Very Easily

This is so easy I almost don't believe it, except I've tested it and it works.

$create = mysql_query("CREATE DATABASE IF NOT EXISTS databasename");

Crazy easy, no?

Sunday, 11 March 2012

Mariam's clock

Note to teacher: Mariam did this herself, she is quite familiar with Flash by now, though she did need some help. When she needed help, I told how to do things, so she did them herself. From this experience, one of the things I could see her learning was that the numbers have to be positioned correctly, or a 'quarter' isn't really a quarter. So she repositioned some numbers in the last page.