The form thing is just a way to make it easier. Once you made a form translater (“list-single” -> comboBox
“text-private”: -> TextInput
“text-multi”: -> TextInput
“text-single”: -> TextInput
“boolean” -> checkBox)
with auto feeding and events checker it’'s easy to configure quite anything!
—For example, I give you my light version (I tried to make it clear and english)
//****************************************************************************** ***//
//–
Initialisation and objects instanciations–
//
//****************************************************************************** ***//
this.attachMovie(“Button”, “sendButton”, _root.curDepth++);
this.sendButton.label = _root.labelSauve;
this.attachMovie(“Label”,“Title”,_root.curDepth++);
//FEEDING FUNCTION - CREATE THE FORM
function feedConf(configurationMessage){
this.Instructions.text=configurationMessage.instructions;
this.Title.text=configurationMessage.title;
tab=configurationMessage.getAllFields();
for(i=tab.length-1;i>=0;i–){
var tabi=tab[ i ];
var index=0;
switch(tabi.type){
case “list-single”:
this.attachMovie(“Label”,"label"tabi.name,_root.curDepth+);
eval(“this.label”+tabi.name).text=tabi.label;
this.attachMovie(“ComboBox”,tabi.name,_root.curDepth++);
for(j=0;j<tabi.getAllOptions().length;j++){
tabio=tabi.getAllOptions();
eval(“this.”+tabi.name).addItem(tabio[j].label);
if(tabi.getAllValues()[0]==tabio[j].label)
index=j;//This is the selected option
}
eval(“this.”+tabi.name).selectedIndex=index;
break;
case “text-private”:
case “text-multi”:
case “text-single”:
this.attachMovie(“Label”,"label"tabi.name,_root.curDepth+);
eval(“this.label”+tabi.name).text=tabi.label;
this.attachMovie(“TextInput”,tabi.name,_root.curDepth++);
if(tabi.getAllValues()[0]==undefined)
eval(“this.”+tabi.name).text="";
else
eval(“this.”+tabi.name).text=tabi.getAllValues()[0];
break;
case “boolean”:
this.attachMovie(“Label”,"label"tabi.name,_root.curDepth+);
eval(“this.label”+tabi.name).text=tabi.label;
this.attachMovie(“CheckBox”,tabi.name,_root.curDepth++);
eval(“this.”+tabi.name).selected=tabi.getAllValues()[0];
break;
default:
break;
}
eval(“this.”+configurationMessage[ i ]).tabIndex=tab.length-i;
}
}
//ACTION FUNCTIONS - SEND THE FORM ONCE FILLED
//****************************************************************************** ***//
//–
Evenements, Behaviors et code boutons–
//
//****************************************************************************** ***//
this.sendButton.onPress=function(){
var fieldmap=new Object;
tab=configurationMessage.getAllFields();
for(i=tab.length-1;i>=0;i–){
var tabi=tab[ i ];
var ar=new Array();
switch(tabi.type){
case “list-single”:
ar.push(eval(“this.”+tabi.name).text);
break;
case “text-private”:
case “text-multi”:
case “text-single”:
ar.push(eval(“this.”+tabi.name).text);
break;
case “boolean”:
ar.push( eval(“this.”+tabi.name).selected?1:0 );
break;
default:
if(ar.push( tabi.getAllValues()[0] )!=undefined)
ar.push( tabi.getAllValues()[0] );
else
ar.push("");
break;
}
if(tabi.name!=undefined)
fieldmap[tabi.name] = ;
else
fieldmap[""] = ;
}
chatRoom.configure(fieldmap);
break;
}
//****************************************************************************** ***//
//–
Position and Size–
//
//****************************************************************************** ***//
function positionAndSize() {
tab=configurationMessage.getAllFields();
this.Title._x=_root.margin;
this.Title._y=_root.margin;
this.Title.setSize(larg-10,25);
var posY=this.Title._y+30;
for(i=tab.length-1;i>=0;i–){
var tabi=tab[ i ];
if(tabi.type!=“fixed”){
eval(“this.label”+tabi.name)._x=_root.margin;
eval(“this.label”+tabi.name)._y=posY;
eval(“this.label”+tabi.name).setSize(larg-150,25);
eval(“this.”+tabi.name)._x=larg-150;
eval(“this.”+tabi.name)._y=posY;
eval(“this.”+tabi.name).setSize(150,25);
posY+=30;
}
}
this.sendButton.setSize(100, 30);
this.sendButton._x = _root.margin;
this.sendButton._y = posY;
};
feedConf(configurationMessage);
positionAndSize();
Of course, the configuration message is obtained by the configureForm event and is available with the eventObj.data
Not for publicity, but I did one
http://usuc.dyndns.org/tv/Jabber/novachat.php
Create a room (in the Menu) and click in the Room Roster and click Configuration.
You should see what it looks like.