bradmicleah
04-02-2003, 05:33 PM
hey
I posted this problem other places but it seems no one knows. Hopefull someone here can help
I am having a problem with the registerClass method of the Application object. I searched numerous resources and found nothing that helped. Right now I'm just going by the Macromedia documentation and it's pretty unclear(to me anyways). I'm not having a problem accessing properties of an object I pass from the client to server. In fact, it doesn't even appear that I have to register the class with the application object for this to work. The problem is, everytime I try to call a method of an object passed from the client to the server I get "TypeError: class_obj.set_id is not a function".
here is the code I'm using on the client side
_________________________________________
#include "netdebug.as"
stop();
client=new NetConnection();
client.onStatus=function(info){
for(var i in info){
trace(i + ": " + info[i]);
}
};
client.ahole=function(cobj){
trace("Bam");
trace(cobj.class_id);
};
a=new my_class();
a.class_id=6;
client.connect("rtmp:/RegisterClass");
client.call("test_class", null, a, client);
function my_class(){
this.class_id=null;
}
my_class.prototype.set_id=function(new_id){
this.class_id=new_id;
};
_______________________________________________
and here is the code I'm using in the main.asc file
_______________________________________________
function my_class(){
this.class_id=null;
}
my_class.prototype.set_id=function(new_id){
this.class_id=new_id;
}
application.onAppStart=function(){
trace("Starting App");
}
application.onConnect=function(new_client){
this.acceptConnection(new_client);
}
Client.prototype.test_class=function(class_obj){
class_obj.set_id(5);
this.call("ahole", null, class_obj);
}
__________________________________________________ __
Hopefully someone has done this succesfully before and can point me in the right direction. Thanks in advance for any help.
cfm
I posted this problem other places but it seems no one knows. Hopefull someone here can help
I am having a problem with the registerClass method of the Application object. I searched numerous resources and found nothing that helped. Right now I'm just going by the Macromedia documentation and it's pretty unclear(to me anyways). I'm not having a problem accessing properties of an object I pass from the client to server. In fact, it doesn't even appear that I have to register the class with the application object for this to work. The problem is, everytime I try to call a method of an object passed from the client to the server I get "TypeError: class_obj.set_id is not a function".
here is the code I'm using on the client side
_________________________________________
#include "netdebug.as"
stop();
client=new NetConnection();
client.onStatus=function(info){
for(var i in info){
trace(i + ": " + info[i]);
}
};
client.ahole=function(cobj){
trace("Bam");
trace(cobj.class_id);
};
a=new my_class();
a.class_id=6;
client.connect("rtmp:/RegisterClass");
client.call("test_class", null, a, client);
function my_class(){
this.class_id=null;
}
my_class.prototype.set_id=function(new_id){
this.class_id=new_id;
};
_______________________________________________
and here is the code I'm using in the main.asc file
_______________________________________________
function my_class(){
this.class_id=null;
}
my_class.prototype.set_id=function(new_id){
this.class_id=new_id;
}
application.onAppStart=function(){
trace("Starting App");
}
application.onConnect=function(new_client){
this.acceptConnection(new_client);
}
Client.prototype.test_class=function(class_obj){
class_obj.set_id(5);
this.call("ahole", null, class_obj);
}
__________________________________________________ __
Hopefully someone has done this succesfully before and can point me in the right direction. Thanks in advance for any help.
cfm