Hi,
I have tried pasting in the code to add the video (the first part), but find I get syntax errors, this is my total script on the main frame, as well as I've placed a video display and named it accordingly and added the component connect as shown below:
errors are:
**Error** Scene=Scene 1, layer=code, frame=10:Line 121: Syntax error.
myCam = Camera.get()
**Error** Scene=Scene 1, layer=code, frame=10:Line 122: Syntax error.
myCam.setQuality(8192,80);
Total ActionScript Errors: 2 Reported Errors: 2
---------------
Am I adding it right, without the addition the code is fine, just when I add the video I get the syntax errors as above.
stop()
//////////////////////////////////////////////////////////////////////////////
//Connect all components
//////////////////////////////////////////////////////////////////////////////
chat.connect(client_nc)
peopleList.connect(client_nc)
myColor.connect(client_nc)
my_video2(client_nc)
//Invisible until we check history
chat._visible = false;
//If we are the only user in this chat, clear the history
checkHistory = new Object()
checkHistory.onResult = function(cant){
if(cant==1) chat.clearHistory()
chat._visible = true
}
client_nc.call("checkClients", checkHistory)
//////////////////////////////////////////////////////////////////////////////
//Get and connect to the SO
//////////////////////////////////////////////////////////////////////////////
client_so = SharedObject.getRemote("users", client_nc.uri, false)
client_so.connect(client_nc)
//////////////////////////////////////////////////////////////////////////////
//SO Handlers
//////////////////////////////////////////////////////////////////////////////
client_so.ref = this
//A new user enters the room
client_so.newUser = function(who){
this.ref.chat.history_txt.text+="***** "+who+" enters the room *****\n"
this.ref.chat.history_txt.scroll+=1
}
//If the second parameter exists, user leaves application, if not, user only leaves private room
client_so.onDisconnect = function(who, app){
for(i in this.ref.inRoom) {
if(this.ref.inRoom==who){
this.ref.inRoom.splice(i, 1)
this.ref["newRoom_"+who].gotoAndStop("Disconnect")
}
}
if(app) {
this.ref.chat.history_txt.text+="***** "+who+" leaves the room *****\n"
this.ref.chat.history_txt.scroll+=1
}
}
//////////////////////////////////////////////////////////////////////////////
//Functions
//This functions are called from inside this movie
//////////////////////////////////////////////////////////////////////////////
// Invite a user to join a private room
function invite(guestUsername) {
if(thinking || invitation) { //busy with a previous request
trace(thinking+" or "+invitation._currentframe)
status.text = "You have pending requests !!"
return;
}
if (_global.username==guestUsername){ //click on myself
attachMovie("thinking", "thinking", 101, {_x:45, _y:25, message:"You couldn't invite yourself !!"});
thinking.gotoAndPlay("Answer")
return;
}
for(i in inRoom) {
if(inRoom==guestUsername){ //yet opened
avisa = (!this["newRoom_"+guestUsername])?attachMovie("thinking", "thinking", 101, {_x:45, _y:25, message:"This user didn't close previous private chat"}) : attachMovie("thinking", "thinking", 101, {_x:45, _y:25, message:"You're in a private room with this user"});
thinking.gotoAndPlay("Answer")
return;
}
}
// Open the 'thinking' movie
this.attachMovie("thinking", "thinking", 101, {_x:45, _y:25});
//Call the invite function in the serverside passing both usernames
client_nc.call("invite", null, _global.username, guestUsername);
}
// Answer a request passing both usernames and a boolean value(flag) to accept or reject
function answer(source, me, flag) {
//Call joinRoom SSAS method
client_nc.call("joinRoom", null, source, me, flag);
}
////////////////////////////////////////////////////////////////////
// NetConnection Handlers
////////////////////////////////////////////////////////////////////
client_nc.ref = this //reference to this timeline
//Shows a messagge asking for opening a private chat room
client_nc.showMessage = function(who) {
if(thinking || invitation) //busy with another request
this.ref.answer(who, _global.username, "busy")
else attachMovie("invitation", "invitation", 100, {_x:45, _y:25, source:who});
}
//Answer to a request for a new private chat room
client_nc.openRoom = function(flag, room, guest){
if(flag == "busy"){
thinking.message = "This user is busy with another request, try later"
thinking.gotoAndPlay("Answer")
return;
}
if(flag == false){ //reject
thinking.gotoAndPlay("Reject")
} else { //accept
this.ref.inRoom.push(guest) //add to the list of opened private rooms
//remove thinking message
if (thinking) {
//removes timeout
clearInterval(this.ref.thinking.timeoutInterval)
//removes clip
removeMovieClip(this.ref.thinking)
}
//remove unclosed previous rooms with a user with this name
if(eval("newRoom_"+guest)) removeMovieClip(this.ref["newRoom_"+guest])
//unique levels for the new private chat room
this.id++
attachMovie("newRoom", "newRoom_"+guest, 110+this.id, {_x:45, _y:25, room:room, guest:guest});
//Check if there's another window opened, and move a litle so they don't overlap totally
if(this.ref.inRoom.length>1) this.ref["newRoom_"+guest]._y+=20
}
}
function pubLive()
{
myCam = Camera.get()
myCam.setQuality(8192,80);
myCam.setMode("160", "120", "4");
srcStream = new NetStream(client_nc);
srcStream.publish(_root.exp, "live"); //this line tell your movie to publish a live stream named by the variable "exp" transmitted
srcStream.attachVideo(myCam);
my_video2.attachVideo(myCam);//this display your cam on a my_video2 object
//myMic = Microphone.get();//you can uncomment this to add audio stream
//srcStream.publish(_root.exp, "live");
//srcStream.attachAudio(myMic);
}
function unpubLive()
{
//srcStream.attachAudio(null);
//unloadMovie(_root.my_videodest);
srcStream.close();
}
function disconnect() {
// Stops publishing the stream.
destStream.close();
// Deletes the source stream connection.
client_nc.close();
}
//PUBLICATION
pubLive();
stop();