0 Replies Latest reply on Sep 2, 2008 7:22 PM by monkeynote

    Problem with my DataTransfer Class

    monkeynote
      hello guys!

      im new to FLEX and im trying to access a data service created in asp.net.

      my problem is that, i can't figure out this error about accessing my class. here is my code

      [code]
      <!-- Test.mxml -->
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      import mx.rpc.events.ResultEvent;
      import mx.collections.ArrayCollection;
      import DataTransfer.UserClass;

      [Bindable]
      private var userData:ArrayCollection;
      [Bindable]
      private var userObject:ArrayCollection;

      private function objectHandler(event:ResultEvent):void
      {
      userObject = event.result as ArrayCollection;

      for (var i:int=0; i < userObject.length; i++)
      {
      var currentUser:UserClass = new UserClass(); /*Type was not found or was not a compile-time constant: UserClass*/
      currentUser = new UserClass(userObject.getItemAt(i)); /* Call to a possibly undefined method UserClass.*/
      userObject.setItemAt(currentUser, i);
      }
      }

      ]]>
      </mx:Script>

      <mx:WebService id="wsASPdotNet" wsdl=" http://localhost:2008/service.asmx?wsdl" showBusyCursor="true">
      <mx:operation name="getUsers" result="objectHandler(event)" />
      </mx:WebService>

      <mx:Button x="10" y="10" label="Get Users" id="buttGetUsers" />
      <mx:DataGrid id="dgUsers" dataProvider="{myObjects}" x="10" y="40" width="490" height="289" />

      </mx:Application>

      [/code]
      [code]
      /*DataTransfer.as*/
      package DataTransfer
      {
      [Bindable]
      public class UserClass
      {
      public var username:String="";
      public var fullname:String="";
      public var useraccess:String="";

      public function Users(obj:Object = null)
      {
      if (obj != null)
      {
      this.username= obj.username;
      this.fullname= obj.fullname;
      this.useraccess = obj.useraccess;
      }
      }
      }
      [Bindable]
      public class ListOfEmployees
      {
      public var Id:int=0;
      public var fName:String="";
      public var lName:String="";

      public function Employee(obj:Object = null)
      {
      if (obj != null)
      {
      this.Id = obj.Id;
      this.fName = obj.fName;
      this.lName = obj.lName;
      }
      }
      }
      }
      [/code]

      what is wrong with my class? why is it not compiled?

      i hope that you can help me guys :( thanks in advance