Using my own class in server extension

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

HooplingMott
Posts: 2
Joined: 28 May 2008, 16:39

Using my own class in server extension

Postby HooplingMott » 29 May 2008, 19:31

<<This topic started off with the following & has progressed to that found at the bottom - Please bear with me...>>

I'm having no luck trying to create an instance of one of my own classes from within an extension.

Where on earth should I place it in the SFS file structure?
<< I think the answer to this is #include old style code??>>

I know it's got to be in the classpath, but I've tried it there already. I know the class code's ok, and I know the extension code's ok.
When I try to use one in the other I get told it doesn't exist in the server dos box.

For instance, with this class:

Code: Select all

class MyClass
{
   private var myList:Array=new Array();
   public function MyClass(){}
   public function pushItem(item:Object){myList.push(item);}
   public function popItem():Object{return myList.pop();}
}

And this line of code in my extension:

Code: Select all

myclass = new MyClass();


with MyClass.as in the CLASSPATH, I get this error:

Error in extension [ calc.as ]: ReferenceError: "MyClass" is not defined. (calc.as#1790) Internal: 307 -- Line number: 306 in file: calc.as

##############################################

OK - Found this topic:
viewtopic.php?t=2895
Which sort of answers the question - use old style 'classes'

But I keep seeing mention of the facrt that you can use code from all sorts of areas server side - AS, Java, Python, etc...

Plus - the class I want to use server side is already used client side - I'd really like to be able to pass instances back & forth.

This can't happen when one side of the pipe's in AS3 & the other in AS1 though can it?

Am I REALLY going to have to create different versions of each class that I want to use both ends?


When's the server side going to come up to date?
& How do I get round the problem in the meantime...?


Any & all help greatly appreciated...

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 77 guests