all groups > macromedia flash flash remoting > june 2004 >
You're in the

macromedia flash flash remoting

group:

ActionScript 2.0 class scripts may only define class or interface constructs.


ActionScript 2.0 class scripts may only define class or interface constructs. japshere NO[at]SPAM hotmail.com
6/1/2004 8:03:37 AM
macromedia flash flash remoting:
I have the following class with the name "Service.as".

#include "NetServices.as"
class Service
{
var GATEWAY_URL:String =
"http://localhost:7001/flashservices/gateway";
var gatewayConnection:NetConnection;
var client;

function Service(argClient)
{
//establish the remote connection only for the first time
if(gatewayConnection === null)
{
NetServices.setDefaultGatewayUrl(GATEWAY_URL);
gatewayConnection = NetServices.createGatewayConnection();
}
this.client = argClient;
}

function get airFrameServiceDelegate()
{
return gatewayConnection.getService("com.flash.HelloWorld",
this.client);
}
}


I am trying to instantiate this class from a flash document. I tried
the following

1) myFlashDocument.protoype = new Service();

2) #include "Service.as"
myFlashDocument.protoype = new Service();

3) myFlashDocument = new Service();

i am getting the following errors here. I have pasted the first and
last message.

Total ActionScript Errors: 62 Reported Errors: 62

**Error** D:\Documents and Settings\jatin\Local Settings\Application
Data\Macromedia\Flash MX
2004\en\Configuration\Include\RsDataProviderClass.as: Line 15:
ActionScript 2.0 class scripts may only define class or interface
constructs.
RsDataProviderClass.prototype.init = function()


**Error** D:\Flash\code\Service.as: Line 3: ActionScript 2.0 class
scripts may only define class or interface constructs.
class Service

Can anybody help me out here.

Thanx
Re: ActionScript 2.0 class scripts may only define class or interface constructs. parker.p NO[at]SPAM ucles.org.uk
6/1/2004 11:50:31 PM
[quoted text, click to view]

This problem is probably caused by the fact that you are using

[quoted text, click to view]

in AS2 you should be using:

import NetServices;

The following is also illegal in an AS2 file:

[quoted text, click to view]

but can't really tell you what you should be using as we cant see the
RsDataProviderClass actionscript.

Hope this helps you on your way.

Re: ActionScript 2.0 class scripts may only define class or interface constructs. hemendras NO[at]SPAM mindfiresolutions.com
6/2/2004 12:40:50 AM
Hi,

Use
import Service.as;
instead of
#include "Service.as"

as to instantiate class in Actionscript 2 or MX 2004 this is the
syntax.This should do, for other errors please post your code for the
file where you instantiate the Service class.

Hemendra Singh Shaktawat

Mindfire Solutions
www.mindfiresolutions.com


[quoted text, click to view]
AddThis Social Bookmark Button