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

Ask a Question related to Macromedia Flash, Design and Development.

  1. #1

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

    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
    ~ jatin
    Jatin Guest

  2. Similar Questions and Discussions

    1. What's the easiest way to..user define class...datagrid..paging..sorting..
      I have a large number of user define class objects and want display in a datagrid and able to perform paging and column sorting. It seems using...
    2. #39403 [NEW]: A class can't implements interface implemented by implemented interface/classes
      From: baldurien at bbnwn dot eu Operating system: Irrelevant PHP version: 5.2.0 PHP Bug Type: Feature/Change Request Bug...
    3. How to Trans transmit my define class with Metthod args in Webservices.
      Example: namespace aa { public class myobject { public string Value1 = ""; } }
    4. Is it possible to put the instance of ASP user define class into the session
      This is my user-defined class class ABC public CC end class I make a instance of it and store it at the session set ee=new ABC ee.CC="hi"...
    5. Define a class using an XML file?
      Dear Sirs, I'm looking for a way to define a class using an XML file. Since I'm building a Web Service to be used by several customers I want to...
  3. #2

    Default Re: ActionScript 2.0 class scripts may only define class or interface constructs.

    > **Error** D:\Flash\code\Service.as: Line 3: ActionScript 2.0 class
    > scripts may only define class or interface constructs.
    > class Service
    This problem is probably caused by the fact that you are using
    > #include "NetServices.as"
    in AS2 you should be using:

    import NetServices;

    The following is also illegal in an AS2 file:
    > RsDataProviderClass.prototype.init = function()
    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.

    P.
    Phil Guest

  4. #3

    Default Re: ActionScript 2.0 class scripts may only define class or interface constructs.

    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
    [url]www.mindfiresolutions.com[/url]


    [email]japshere@hotmail.com[/email] (Jatin) wrote in message news:<5b79e941.0406010703.1b1a702e@posting.google. com>...
    > 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
    > ~ jatin
    Hemendra Singh Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139