The integration of FLASH is really simple using the XML capabilities of SMS Fox Box.


A lot of website are using FLASH technology because it offers the opportunity to create really nice interfaces with animations and user interaction.
In this page we will create a simple FLASH interface that show you the last SMS received.




As all other processes also this one is controlled by the main event handler.
The code below is the call to the module from event handler and it is a portion of it

.....
#Save messages in XML format
#if [ "$1" = "RECEIVED" ]; then
#/etc/sms/scripts/sms2xml $1 $2 $3
#fi
#
....

To activate de-activate the module you have always to remember to remove/add the # sharp character as
described in the Event Handler how to.

After the activation of the sms2xml script, each time you receive an SMS it will be stored to http:///xml/sms.xml
The format of the file sms.xml is as follow:




393494703237
text of the message


To load the XML file inside flash we need to write a little procedure with actionscript (Courtesy of Roberto Corti):

// Author: Roberto Corti
// Create new XML Object and set ignoreWhite true to ignore white spaces
messaggio = new XML();
messaggio.ignoreWhite = true;

// Load the XML file where your informations are stored
messaggio.load('sms.xml');

messaggio.onLoad = function (success) {
if (success) {
// If your XML Document is loaded succesfully you can procede with the for function
for (var n = 0; n
trace(n + ' ' + messaggio.firstChild.childNodes[n].firstChild.nodeValue);
}
// You can display the nodeValue into the stage using variables
from = messaggio.firstChild.childNodes[0].firstChild.nodeValue;
msg = messaggio.firstChild.childNodes[1].firstChild.nodeValue;
}
};

Click here to download the full example.