Hello,
<?xml version="1.0" encoding="utf-8"?>
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"
title="Monitor" xmlns:plcservicebean="server.services.plcservicebean.*">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.CallResponder;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
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