4 Replies Latest reply on Aug 30, 2006 3:15 AM by Newsgroup_User

    Java adapter example not compiling

    smakwam2006 Level 1
      Hi folks,
      Can anyone please let me know why I get the error : "1046: Type was not found or was not a compile-time constant: Contact"
      on this line : public var contact:Contact; in my Flex 2 app example which I am following at http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=L iveDocs_Parts&file=00000138.html

      I have followed the tut so far down to the letter, but still no joy.
      I have the following setup:
      1) flex 2 data services setup at :
      2) copied the structure as required for Contact.as - this file is in the folder C:\fds2\jrun4\servers\default\samples\DSLessons\samples\contact\Contact.as which as far as I can tell is correct. The contents of contact.as is straight from Adobe :
      // Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
      // All Rights Reserved.
      // The following is Sample Code and is subject to all restrictions on such code
      // as contained in the End User License Agreement accompanying this product.
      // If you have received this file from a source other than Adobe,
      // then your use, modification, or distribution of it requires
      // the prior written permission of Adobe.
      package samples.contact

      public class Contact
      public var contactId:int;

      public var firstName:String = "";

      public var lastName:String = "";

      public var address:String = "";

      public var city:String = "";

      public var state:String = "";

      public var zip:String = "";

      public var phone:String = "";

      the mxml is :

      <?xml version="1.0" ?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      import mx.data.DataService;
      import mx.collections.ArrayCollection;
      import samples.contact.Contact;

      public var ds:DataService;

      public var contacts:ArrayCollection;
      public var contact:Contact;


      <mx:DataGrid id="dg" editable="true">
      <mx:DataGridColumn dataField="contactId" headerText="Id" editable="false"/>
      <mx:DataGridColumn dataField="firstName" headerText="First Name"/>
      <mx:DataGridColumn dataField="lastName" headerText="Last Name"/>


      as you can see, I have not even completed it yet !!!!

      any help would be appreciated.

        • 1. Re: Java adapter example not compiling
          Jorge_Juan Level 1
          In which directory is your mxml file? It should be in C:\fds2\jrun4\servers\default\samples\DSLessons.
          The import samples.contact.Contact tells the compiler to look for a directory structure samples\contact, then the class Contact.as. This dir structure has to be under relative to the mxml file.

          • 2. Re: Java adapter example not compiling
            Jorge_Juan Level 1
            BTW, a note was added by the Adobe doc guys:
            mpeterson said on Jul 5, 2006 at 1:19 PM :

            The "contact" sample application used in this tutorial IS NOT included in the Flex Data Services samples web application. The required files are available in the following zip file, which you can unzip into the samples (root directory) of the samples web application:

            After unzipping the file, copy the following destination definition after the last destination in the samples/WEB-INF/flex/data-management-config.xml file:
            <destination id="contact">

            <adapter ref="java-dao" />


            <identity property="contactId"/>

            <paging enabled="false" pageSize="10" />
            <throttle-inbound policy="ERROR" max-frequency="500"/>
            <throttle-outbound policy="REPLACE" max-frequency="500"/>




            - Mike Peterson
            Adobe Flex documentation team

            • 3. Re: Java adapter example not compiling
              smakwam2006 Level 1
              thanks for the quick reply, it is ok now I think.

              • 4. Re: Java adapter example not compiling
                Level 7
                thanks for the quick reply, it is ok now I think.