OOP SF Server Extension with AS2.0

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

knonk
Posts: 14
Joined: 28 Jan 2008, 08:04

OOP SF Server Extension with AS2.0

Postby knonk » 05 Sep 2008, 07:46

Hi,
How can I write SF Server Extension in OOP with AS2.0. I don't know does Smartfox support it ?

My project is built in OOP with AS2 in client thus I want to write OOP in Server side too. but I can't '#include' or 'import' the AS class in server side.
were I wrong ? Im not familiar with Python or Java, never use it before.
and i'd like to write OOP with AS2 and it will safe my time if i can write OOP with AS2 in server side,How can i do it ?
Menser
Posts: 111
Joined: 13 Nov 2007, 18:32

Postby Menser » 06 Sep 2008, 03:31

Heya-

Sadly you cant use AS2 (or 3 ) on the server side, just AS1.

You can however still create classes and such, just have to do it using the AS1 ways.


Ill demonstrate a bit below.
Creating object functions

Code: Select all

MyObject.prototype.functionname = function(param1, param2){

//function code here.

}

//Creating Variables on your object

MyObject.prototpye.MyVar = 1;

//Then when interacting later you can access them via

MyObject.functionname(arg1,arg2);
trace(MyObject.MyVar);


Hope that helps a bit
_-Menser-_

PS: Anyone know why the forums only translate the first tag of a type used ([code] , [url], etc)? Its rather annoying.
knonk
Posts: 14
Joined: 28 Jan 2008, 08:04

How to include my class ?

Postby knonk » 06 Sep 2008, 04:10

Thanks Menser,
But if i have 2 AS1 class in 2 files, How can i include it in to my server side file, it dosesn't accept "#include" or "import".
Do i have to code all classes in my server side(omg) it so diffrent to manage code ?!!!!

Other question is : if i worte 1 Java class with package name is :it.gotoandplay.extensions.examples and my class name is myHello, then I push myHello.java and myHello.class in to "..\SmartFoxServerPRO_1.5.5\Server\javaExtensions\it\gotoandplay\extensions\examples\" folder. I tried to use my myHello class in other Action script server side file(both loaded in room extension tag already) but that class still wasn't undefined in AS file. How can I use it ?
Menser
Posts: 111
Joined: 13 Nov 2007, 18:32

Postby Menser » 06 Sep 2008, 04:22

Hey-

You are able to use #include in your scripts. So you could have a "class" file for each class that you have, and include them into your mains script file.


#include <filename>


make sure not to put a semi-colon at the end, it doesnt like that.

Hope that Helps
_-Menser-_
knonk
Posts: 14
Joined: 28 Jan 2008, 08:04

Postby knonk » 06 Sep 2008, 04:25

Let me try it !
and other question is : if i worte 1 Java class with package name is :it.gotoandplay.extensions.examples and my class name is myHello, then I push myHello.java and myHello.class in to "..\SmartFoxServerPRO_1.5.5\Server\javaExtensions\it\gotoandplay\extensions\examples\" folder. I tried to use my myHello class in other Action script server side file(both loaded in room extension tag already) but that class still wasn't undefined in AS file. How can I use it ?
User avatar
Lapo
Site Admin
Posts: 21690
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 08 Sep 2008, 16:37

You can learn all the details in the documentation, chapter 6.6

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 20 guests