Welcome!

Return to the Module Documentation Index

If you are reading this, then you're probably already an avid FlashChat user who wishes to enhance and expand the capabilities of FlashChat. This module package provides 6 useful add-ons that you can use with FlashChat. There are a few important facts that you should know first...

1) You may only use one module at a time.

This means that you cannot have the "admin" module and the "web radio" module functioning at the same time. This was done deliberately because loading multiple modules causes the Flash interface to slow down too much. Later versions of FlashChat may contain sufficiently many interface optimizations to allow for many modules, but for now you should not expect to load more than one module at a time.

2) The Web Radio Module ONLY works with Mozilla Firefox. There is an issue with the Flash player ActiveX object on Internet Explorer. You can read more about this problem on the Macromedia forums.

3) To enable any module, you should edit the config.php file. I strongly suggest using a good text editor like Textpad, rather than the Microsoft Windows text editors. Please be sure to BACKUP any PHP file that you modify, so that you can quickly restore FlashChat to its original state, in the event that a PHP error is introduced while editing.

Scroll towards the middle of config.php, and locate the following section:

 'module' => array(
	'anchor'  => 0,
	'path'    => 'modules/mp3_player/mp3player.swf',
	'stretch' => true,
	'float_x' => 300,
	'float_y' => 200,
	'float_w' => 100,
	'float_h' => 100,
 ),

Here's what these settings mean: 'anchor' determines where on the interface the module should load. The default setting of 0 puts the module directly below the room list. For most users this is probably the best location, since most FlashChat installations only use a few rooms. If you have a dozen or more rooms in your chat, you might consider changing this to -1, which will cause the module to occupy a floating popup window. The popup window width, height and x/y position can then be adjusted using 'float_x', 'float_y', 'float_w', and 'float_h'.

The most important parameter to get the module working at all is 'path'. This must be set it to the SWF path for the module that you wish to use. For example, if you have loaded the modules into the 'modules' sub-folder in FlashChat, then your MP3 player SWF path would probably be something like 'modules/mp3_player/mp3player.swf'. If you change the module path, don't forget to update config.php!

Finally, if you wish the module to occupy 100% of the space available to it, then you should set 'stretch' to true, as shown above. This means that if a user resizes his browser window, or resizes the FlashChat panes, then an 'onresize' event will be sent to the module SWF, and the module will resize itself accordingly.

4) The demo for these modules on TUFaT.com has a combo-box whereby you can choose the module to load, then login to the chat. This is not actually how you will use the modules, however. The module of your choice must be enabled in FlashChat's /inc/config.php file.

In case you would like to setup something like the demo, here's one possible way to do this:

a) In flashchat.php, add this code before the start of the HTML code (i.e., immediately before the ?> symbol):

if ( $_REQUEST['module'] ) {
	setcookie( 'chat_module', $_REQUEST['module'], time()+60*60*24, '/' );
}

b) In /templates/index.tpl, add the following table row after the language selection row:

<tr>
<td><div align=right>Module:</div></td>
<td>
<select name=module>
<option value='1'>MP3 Player</option>
<option value='2'>Web Radio</option>
<option value='3'>Banner Ads</option>
<option value='4'>Text Ads</option>
<option value='5'>Admin</option>
<option value='6'>Whiteboard</option>
</select>
</td>
</tr>

c) In /templates/index.tpl, change the Javascript "popupLogin" function to the following.

function popupLogin() {
	// check to make sure a valid username has been entered
	if (!formIsValid()) return;

	var username = document.login.username.value;
	var password = document.login.password.value;
	var lang = document.login.lang.value;
	var module = document.login.module.value;

	// the size of the popup window
	var width = 800;
	var height = 600;

	// the x,y position of the popup window
	// NOTE: this formula will auto-center the popup on the screen
	var y = (screen.height - height) / 2;
	var x = (screen.width - width) / 2;

	var url = "flashchat.php?username=" + username + "&password=" + password + "&lang=" + lang + "&module=" + module;
	var options = "width=" + width + ",height=" + height + ",top=" + y + ",left=" + x + ",resizable";

	// open the chat window as a popup, instead of embedded in webpage
	window.open( url, "chat", options );
}

d) In settings.php, change the <module...> section to the following (this is towards the very end of the file, immediately before the </settings> tag.

<module <?php
switch ( $_COOKIE['chat_module']
) {
case '1':
	$GLOBALS['fc_config']['module']['path'] = 'modules/mp3_player/mp3player.swf';
	break;
case '2':
	$GLOBALS['fc_config']['module']['path'] = 'modules/web_radio/webradio.swf';
	break;
case '3':
	$GLOBALS['fc_config']['module']['path'] = 'modules/banner/banner_ad.swf';
	break;
case '4':
	$GLOBALS['fc_config']['module']['path'] = 'modules/text_ads/text_ads_module.swf';
	break;
case '5':
	$GLOBALS['fc_config']['module']['path'] = 'modules/admin/admin_module.swf';
	break;
case '6':
	$GLOBALS['fc_config']['module']['path'] = 'modules/whiteboard/whiteboard.swf';
	break;
}

echo array2attrs($GLOBALS['fc_config']['module'])?>/>

d) Reload FlashChat by refreshing your browser and then login with the module of your choice. All done!