Monday, July 27, 2009

Why am I getting this class error in Flash when including "NetServices.as"?

I am working on a Flash Remoting project (Flash 8, btw). When I check for script errors, the output panel, I get this response:





"**Error** C:\CFusionMX7\wwwroot\Configuration\NetS... Line 22: Classes may only be defined in external ActionScript 2.0 class scripts.


class mx.remoting.NetServices extends Object "





I thought this NetServices file WAS an external class constructor...but I'm newbie and obviously am missing something here. Probably better to post this on a Flash forum, which I think I'll do, but any help here would be appreciated.

Why am I getting this class error in Flash when including "NetServices.as"?
The code fragment:


"class mx.remoting.NetServices extends Object "


declares a new class which, as far as I can understand, is not what you want to do because NetServices already exists as a compiled object in the Flash library.





If you want to use this class what you need to do is import it by using the following code:





import mx.remoting.NetServices;





then you can create an instance of the class by typing something like:





var myServices:NetServices = new Netservices();





The variable myServices is then an "Instance" of the class Netservices and you can then use it whatever you want to do with this Class





Please be advised this is general advise and I do not know this particular Class. this is just the way classes and OOP works in Flash.





I hope this helps you
Reply:This might help:





Runtime Errors and others:


http://support.microsoft.com/default.asp...





Good Luck


No comments:

Post a Comment