Lisamaterjalide loend
Algne fail: vana_veeb/ZZ_FlashChat/readme_chatengine.htm.
| ZZ:FlashChat
2 - Chatengine |
DEFINITION:
| |
ZZ:FlashChat 2 - Chatengine is the file in the ditribution:
'chatengine.swf'
This file contains the information neccessary for the chat
to work
(i.e. main functions of communication between Flash Chat
- Interface and PHP scripts).
The chatengine itself delivers several functions and a lot
of variables to the Flash-file it is loaded into. With this
functions and variables it is possible to create the ZZ:FlashChat
functionality in any flash file.
Therefore the aim of this chatengine is that you can easily
build up your own chat interface and can then add ZZ:FlashChat
functionality with calling only a few functions from the
chatengine.
In the following test the usage of the chatengine will be
described ! |
| |
|
|
IMPORT & USAGE:
| |
Of course you have to import the
chatengine into your custom chat file to use its chat functions.
The procedure of doing this will now be explained: |
| |
1) |
You have to import 'chatengine.swf' to your custom chat
interface.
You can do that with the following code:
loadMovieNum ("chatengine.swf",
100);
With this code the chatengine movie will be loaded to _level100
of your main movie.
You should create a preloader for 'chatengine.swf', because
full functionality can only be guaranteed if the whole file
is loaded.
|
| |
2) |
Somewhere in the timeline there should follow the following
code:
_level100.start_chat();
This means that you call the function start_chat()
in the movie-clip on level 100
(that is where we loaded the chatengine in (see top)).
The start function loads the initial variables into flash
and prepares the chat to start ! |
| |
3) |
Afterwards in the timeline you have to put the following
code:
_level100.get_data("[name of the outputfield]");
This functions calls the chatdata in a time intervall you
defined with chatspeed.
Your main movie will stop at the frame this action is in.
On ChatError which means that the user is kicked, banned
or the chat is closed your movie will play further again.
You have to type the name of the textfield showing the chat-output
in the brackets of this function.
(e.g.: _level100.get_data("output");
) |
| |
4) |
With the _level100.stop_chat(); -action
you stop the chatengine from calling chatdata. |
| |
The normal order of these commands is the following:
After the stop_chat-function you can define a custom errorhandler,
which means:
you define what will be shown to the user on a certain error.
You will find more information on that in the explanation
of FUNCTIONS & VARIABLES. |
|
FUNCTIONS & VARIABLES:
| |
The following functions can be called in the file ZZ:FlashChat-Chatengine
was loaded to.
start_chat();
Prepares chat to work; Loads neccessary variables,
etc.
Is the first function to be called.
set_chatspeed(speed);
Sets a new chatspeed if not defined in the 'inc.config.php'.
Has to be called just after the start_chat()-function.
get_data("[name of outputfield]");
Will stop the main movie and will start a loop of calling
the chat data (messages and usernames) in a certain time intervall
defined by the chatspeed variable.
At the end of calling data from the chat the following variables
are available in the main file
| |
chat_userstatus
the status of the chatuser is a variable defining
if a user is kicked, banned, the chat is closed or everything
is o.k.
A userstatus of: 0 means:
everything is alright - user is loggedin and ready
-1 means: chat is closed by
admin -2 means: user is
kicked by admin -3 means:
user was kicked by chat due to inactivity >0
means: a number higher than 0 defines the number of
minutes a user is banned from th chat. (so: 30 means:
banned for 30 minutes, 10 means: banned for 10 minutes) |
| |
chat_error
is the errormessage corresponding with the userstatus.
e.g. if userstatus = 30, chat_error will be: "You
have been banned for 30 minutes !" |
| |
chat_userlist
is a list of all users currently online. It has got
the following format:
Users are divided by ':' because this sign is not
allowed for a username (it is used for sending commands
in the CommandLine).
It will look like that:
user01:user02:user03:user04
You can then reformat it in Flash and use it in your
custom chat interface. |
| |
chat_usercount
is the number of users currently online. |
| |
chat_custom();
Everytime the get_data()-function gets the chat data
it will call this function on the main timeline of your
movie clip.
If this function exists the commands in it will be called.
This gives you the possibility to work with the data
the get_data()-function returns. |
open_admin();
Loads the AdminSection-Movie into the main movie
!
close_admin();
Unloads the AdminSection-Movie from the main movie
!
open_help();
Loads the HelpMenu-Movie into the main movie !
Returns the variable chat_help
to the main-movie, which holds the help text !
close_help();
Unloads the HelpMenu-Movie from the main movie !
|
|
NOTICE:
| |
The chatengine is the core of ZZ:FlashChat !
The .fla-file will NOT be distributed with the official
distribution.
Anyone who wants to alter the code and therefore the functionality
of ZZ:FlasChat has to contact me by email and will then
receive the original .fla-file.
This gives me a slight control who and especially how somebody
is working on this code ! |
|
| script by |
zehnet.de | |
|