You can’t use the classname for your id.  Change id=”services” to something like id=”myServices” and then do myServices.myRemoteObject…

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, August 16, 2005 8:25 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Calling RemoteObject declared in a mxml component in an application-The property being referenced does not ...

 



I want to have all my RemoteObject declarations in a mxml component that I
can later use in another application. I created a services.mxml file where
I have something like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.macromedia.com/2003/mxml">
      <!--
========================services.mxml=========================== -->
      <!--
==================================================================== -->
      <!-- Remote Java Objects
-->
      <!--
==================================================================== -->
            <mx:RemoteObject id="myRemoteObject"
            source="com.remote.object"
            result="event.call.resultHandler(event.result)">
            <mx:method name="getMyData"></mx:method>
            </mx:RemoteObject>

      <!--
==================================================================== -->
      <!-- Web Services
-->
      <!--
==================================================================== -->

      <!--
==================================================================== -->
      <!-- HTTP Services
-->
      <!--
==================================================================== -->

</mx:Canvas>



Then I call it like this:


<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns:i2="*">
    <mx:Script>
    <![CDATA[

        public var myList:Array= new Array();

      // Remote call to getMyData in the Java service. Handler below
       private function getMyList(): Void
       {
         var category:String="something";
          var pendingCall = services.myRemoteObject.getMyData(category);
            pendingCall.resultHandler =
mx.utils.Delegate.create(this,resultHandler)
       }
        function resultHandler(result): Void
       {
             myList= result;
        }


    ]]>
    </mx:Script>

      <!--
======================================================================== -->
      <!-- View                                                 -->
      <!--
======================================================================== -->
      <mx:ComboBox  dataProvider="{myList}"  id="cb_1"
initialize="getMyList()"  width="200"  />

      <!--
==================================================================== -->
      <!-- Remote Java Objects
-->
      <!--
==================================================================== -->
      <i2:services id="services" />



      </mx:Application>


  However I get this error message:

            The property being referenced does not have the static
attribute.

  I have tried to call it like this,

      var pendingCall =
mx.core.Application.application.services.myRemoteObject.getMyData(category);

  which doesn't give any error but doesn't return any data.

Any ideas?

  Thanks


---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Computer software testing Macromedia flex Development
Software developer


YAHOO! GROUPS LINKS




Reply via email to