开发者

Unable to bind to a variable

            import server.valueObjects.Data;

            [Bindable] 
            public var dbl:Number;
            [Bindable]
            public var val:String;


            public function clientMonitor():void{
                var callResp:CallResponder = new CallResponder();
                callResp.addEventListener(ResultEvent.RESULT, monitorResult);
                callResp.addEventListener(FaultEvent.FAULT, monitorFault);
                callResp.token = plcServiceBean.getMonitorData();
            }

            public function monitorResult(event:ResultEvent):void{
                dbl = event.result.value as Number;
                val = dbl.toString();
                trace (dbl);
                trace(val);
            }

            protected function monitorFault(event:FaultEvent):void{
                Alert.show(event.fault.faultString, "Error while monitoring Data ");
            }
        ]]>
    </fx:Script>
    <s:layout>
        <s:VerticalLayout horizontalAlign="contentJustify" />
    </s:layout>

    <fx:Declarations>
        <plcservicebean:PlcServiceBean id = "plcServiceBean" 
                                       showBusyCursor="true" 
                                       fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"/>
    </fx:Declarations>
    <mx:Form height="103">
        <mx:FormItem label="View" x="2" y="11">
            <s:TextInput id = "view1"
        开发者_运维百科                 text="{val}"/>
        </mx:FormItem>
    </mx:Form>
</s:Panel>

Here the method clientMonitor() is called on creationcomplete() from the main application.

I am not able to bind the Bindable variable dbl to my textInput. Using the debugger, I am able to see that the result is assigned successfully to variable dbl, but it is not able to bind it to the text of view1. I see a NaN displayed in the text of view1.

-H


You're trying to bind a Number to a String. Try making the types the same and see if that has an effect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜