Flash CS3 and the AS3 api: A working example?

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

Moderators: Lapo, Bax

Post Reply
chichilatte
Posts: 4
Joined: 29 Aug 2007, 14:56
Contact:

Flash CS3 and the AS3 api: A working example?

Post by chichilatte »

Has anyone managed to get a simple example of the AS3 api working in the Flash CS3 authortime? I want to get a quick Papervision3D multiplayer game built, but it's not happening!

I've got the api all set up at it.gotoandplay.smartfoxserver
and my flash class goes something like this...

Code: Select all

package
{
	import it.gotoandplay.smartfoxserver.SmartFoxClient;
	import flash.display.MovieClip;

	public class Test1 extends MovieClip
	{

		public function Test1()
		{
			var sfs:SmartFoxClient = new SmartFoxClient();
		}
	}
}
... but I get a compilation error. Namely...
1172: Definition mx.charts:AreaChart could not be found.
occuring in it.gotoandplay.smartfoxserver.util.Entities

I've run into this sort of thing before, and it is usually that the library api is designed for Flex, which seems to use a lot of mx... classes.

Has anybody had better luck? Any inkling at all? AS3 documentation is sparse as hell!
patso
Posts: 380
Joined: 13 Nov 2006, 13:44
Location: Sofia, Bulgaria

Post by patso »

Just in case - you can found the Flash CS3 AS3 version of the API here - http://forums.smartfoxserver.com/viewtopic.php?t=1424.

I've tried the template.fla that comes with the zip file and it works perfect.
chichilatte
Posts: 4
Joined: 29 Aug 2007, 14:56
Contact:

Post by chichilatte »

Weeeeeeeeeeee! Yay! Thanks Patso, that did the trick. I has an outdated/wrong version of the it.gotoandplay.smartfoxserver library.


I got my version from...
http://www.smartfoxserver.com/download/ ... _beta4.zip

which is in beta, and seems to be Flex only. And was the completely wrong thing anyway! what a dope!

So now I've got it compiling nicely, but can't connect to the server...
[Sending]: <msg t='sys'><body action='verChk' r='0'><ver v='141' /></body></msg>

[ RECEIVED ]: <msg t='sys'><body action='apiOK' r='0'>, (len: 40)
TypeError: Error #1085: The element type "body" must be terminated by the matching end-tag "</body>".
at it.gotoandplay.smartfoxserver::SmartFoxClient/::xmlReceived()
at it.gotoandplay.smartfoxserver::SmartFoxClient/::handleMessage()
at it.gotoandplay.smartfoxserver::SmartFoxClient/::handleSocketData()
I think I can work this out myself. Thanks again Patso.
chichilatte
Posts: 4
Joined: 29 Aug 2007, 14:56
Contact:

Post by chichilatte »

Ok, got it working totally. I was using the SFS Server Lite 0.9.7 , which doesn't work with the AS3 API apparently. I wish they'd put that in big BOLD letters.

I uninstalled the Lite version and installed SFS Pro 1.5.5 instead, and the template.fla works perfectly.

NOTE: I read in the SFS Pro 1.5.8 patch page that the Basic server version works with the AS3 API, so it seems like the as3 compatibility is working its way down to Lite.

Very pleased it's purring along now tho [/ :<3 )
Post Reply