|
Shared Text Box in FCS via RTMP
|
 |
This example shows how to create a common shared text box. Replace UserName with your UserName on our server. Open the test script in two or more seperate browser windows. When you type in one window all of the other windows are updated.
Since we set the third parameter to true in our getRemote connection, the file will always be saved.
This example requires a text box placed on the main stage in your Flash file. Name the instance name of the text box "Notepad" and set it to multiline with box border.
Place the following Action Script in frame one.
#include "NetDebug.as"
stop();
myChannel = "Notepad";
myNC = new NetConnection();
Notepad.text = "Connecting to "+myChannel;
myNC.connect("rtmp://66.216.97.115/UserName/tc");
trace(myChannel+"="+myNC.uri);
mySO = SharedObject.getRemote(myChannel, myNC.uri, true);
mySO.connect(myNC);
myNC.onStatus = function(info) {
trace("Level: " + info.level + newline + "Code: " + info.code);
output += "Level: " + info.level + "Code: " + info.code+newline;
}
mySO.onSync = function(sync) {
for (z = 0; z < sync.length; z++ ){
trace("SYNC:"+sync[z].name);
if (sync[z].name eq "nText"){
Notepad.text = mySO.data[sync[z].name];
}
}
}
Notepad.onChanged = function(){
mySO.data.nText = Notepad.text;
};
|