Announcement Announcement Module
Collapse
No announcement yet.
RemoteObjects: TypeError: Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RemoteObjects: TypeError:

    Hey there,

    I am using remoteobjects and configured it in application-context properly. Now it executes while my application is initializing and whenever this call happens, I am receiving this below error:

    TypeError: Error #1034: Type Coercion failed: cannot convert Object@203be679 to mx.messaging.messages.IMessage.

    Now I am unable to understand where should I put this type casting.

    Although, if I make this call on a button click or on any other event after application initialization, it executes successfully.

    Any pointers in here..

    Thanks,
    Manu.

    Revision:
    Just by putting an empty <mx:RemoteObject/> resolves this issue.
    Apart from that, I tried to put "ClassXYZ = ClassReference("mx.rpc.remoting.mxml.RemoteObject" )" in properties file, but still no luck.
    Last edited by manuraj.dhanda; Apr 13th, 2010, 02:52 PM. Reason: Revision

  • #2
    class inclusion problem

    Hey there,

    this is a class inclusion problem, apparently the RemoteObject class doesn't get included properly, even when using "ClassXYZ = ClassReference("mx.rpc.remoting.mxml.RemoteObject" )" in your properties file.

    You can try adding a dummy variable somewhere in your source:
    Code:
    private var dummyRemoteObject:mx.rpc.remoting.mxml.RemoteObject;
    that should force the class to be linked.

    hope that helps,

    cheers,

    Roland

    Comment


    • #3
      Strange, I'm having the same problem with the same class, RemoteObject, adding the class to my code doesn't seem to fix it.

      btw: is'nt <mx:RemoteObject> really a different class then the one you usually use?

      there are:

      mx.rpc.remoting.RemoteObject
      mx.rpc.remoting.mxml.RemoteObject

      any way, I tried to include both and it did not work.

      my context

      Code:
      	<object id="myService" class="mx.rpc.remoting.RemoteObject">
      		<property name="destination" value="deviceService"/>
      		<property name="channelSet">
      			<object id="myChannelSet" class="mx.messaging.ChannelSet">
      				<method-invocation name="addChannel">
      					<arg>
      						<object class="mx.messaging.channels.AMFChannel">
      							<constructor-arg value="my-amf"/>
      							<constructor-arg value="http://localhost:8080/myapp/messagebroker/amf"/>
      						</object>
      					</arg>
      				</method-invocation>
      			</object>
      		</property>
      	</object>
      	
      	<object id="myDelegate" class="com.mypath.MyDelegate">
      		<property name="service" value="myService"/>
      	</object>
      when I run this, it complains that

      Code:
      TypeError: Error #1034: Type Coercion failed: cannot convert "myService" to mx.rpc.remoting.mxml.RemoteObject.
      Any ideas?
      thanks
      Lior

      Comment


      • #4
        typing

        It seems you have typed the service property on your delegate to mx.rpc.remoting.mxml.RemoteObject, yet the service that is defined in the XML is of type mx.rpc.remoting.RemoteObject.

        Since mx.rpc.remoting.mxml.RemoteObject inherits from mx.rpc.remoting.RemoteObject you can't cast the mx.rpc.remoting.RemoteObject to mx.rpc.remoting.mxml.RemoteObject.

        So, the solution in your case would be to either type the service property to mx.rpc.remoting.RemoteObject or change the XML config to mx.rpc.remoting.mxml.RemoteObject.

        I know this sounds confusing, but in the end it makes sense, just swap the mx.rpc.remoting.mxml.RemoteObject and mx.rpc.remoting.RemoteObject with Apple and Orange and it'll make more sense

        hope that helped,

        cheers,

        Roland

        Comment


        • #5
          Thanks Ronald, all these tests I've made while switching from the mxml remoteObject to the parent one really made my code messed up, but unfortunately this is not the issue, I've fixed the code to contain only references of one of the remoteObjects and no matter what I do I keep getting the the type error.

          Comment


          • #6
            sample app

            Hey there,

            could you post a small sample app here so we can have a look at the project? I'm convinced that something very simple is wrong, but having a bit of context will greatly help.

            thanks in advance,

            Roland

            Comment


            • #7
              thanks, I'll setup a sample and send you or post here.

              Comment

              Working...
              X