The lastResult property won't be populated until a result comes back
some time later (and definitely after the onLoad() function exits
because remote requests are made by the player in an asynchronous manner
after the current frame script execution finishes).
 
Pete

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Evgeniy Strokin
Sent: Thursday, June 14, 2007 4:08 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] for RemoteObject lastResult return NULL in
function



Hello, I have a problem. If I'm getting null from
myRo.getGetMyObj.lastResult in function onLoad(),.. but it returns value
in here:
<mx:TextInput id="txt2" text="{myRo.getGetMyObj.lastResult.otherProp}"/>
But when I'm sending the object back to the server everything is fine.
This works fine, I'm getting right values in server from Java Object:
myRo.setGetMyObj(mm);
But the same Java Object cannot be cast to the MyTestObject.as
In other words: I'm able to submit from my MyTestObject.as to
MyTestObject.java, but not vice verse. But i'm getting result from
MyTestObject.java though, but only here: <mx:TextInput id="txt2"
text="{myRo.getGetMyObj.lastResult.otherProp}"/>, this doesn't work
(returns null always): mm1=MyTestObject(myRo.getGetMyObj.lastResult);
Does somebody kno! w why? Maybe it shouldn't work at all this way?

Thank you

PS: here is mxml I use:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " xmlns="*"
                creationComplete="onLoad();">
    <MyTestObject id="mm" myProp="{txt1.text}"
otherProp="{Number(txt2.text)}"/>
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            [Bindable]
            private var mm1:MyTestObject;

        !     private function onLoad():void{
                myRo.getGetMyObj();
                mm1=MyTestObject(myRo.getGetMyObj.lastResult);
            }

            private function clickHandler():void {
                 myRo.setGetMyObj(mm);
            }
        ]]>
    </mx:Script>
    <mx:RemoteObject id="myRo" destination="myObject"
showBusyCursor="true"/>
    <mx:Form id="frm" defaultButton="{sbmt}">
    &! nbsp;   <mx:FormItem label="Data 1">
            <mx:TextArea id="txt1" text="{mm1.myProp}"/>
        </mx:FormItem>
        <mx:FormItem label="Data 2">
            <mx:TextInput id="txt2"
text="{myRo.getGetMyObj.lastResult.otherProp}"/>
        </mx:FormItem>
        <mx:FormItem>
            <mx:Button id="sbmt" label="Button" click="clickHandler();"
width="100%" height="100%"/>
        </mx:FormItem>
    </mx:Form>
</mx:Application>



 

Reply via email to