Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Supporting Technologies > Flash Media Server

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-02-2003, 06:33 PM   #1
bradmicleah
Registered User
 
Join Date: Apr 2003
Posts: 1
Default trouble with registerClass method of Application object

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
bradmicleah is offline   Reply With Quote
Old 04-09-2003, 12:48 AM   #2
zerooito
Registered User
 
zerooito's Avatar
 
Join Date: Nov 2002
Location: BRASIL
Posts: 126
Send a message via ICQ to zerooito
Default Try this

Hey, dude...

I've read your code for a while, I think I can understand
what you wanna do, but I have a question to make:

Why do you want to use this:

ActionScript Code:
function my_class(){ this.class_id=null; } my_class.prototype.set_id=function(new_id){ this.class_id=new_id; }

I would do it in another way:

ActionScript Code:
client.prototype.my_class = function set_id(new_id){         this.id = new_id; } client.prototype.id = null;

I think it would make the same effect as you're expecting, no?

There's one more thing I could see in your code:

In your client side script, you've used a call function
client.call("test_class", null, a, client);

but in your server side, you got this function with wrong
numbers of parameters:

Client.prototype.test_class=function(class_obj){
class_obj.set_id(5);
this.call("ahole", null, class_obj);
}

your call at client sends two parameters, and your server
side script expects just one, right? I think it won't run.

anyway, I didn't test anything... I'm just telling what I think
would help... like you, I can't find nobody to help me with
comm server questions.

I hope that helps.

Ah... there's one more thing!
server side scripting is case sensitive...
client side isn't... it's a big damn thing!

C ya!

Zerooito
zerooito is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:09 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.