MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Guía de usuario Pagina 225

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 256
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 224
Build a distributed application with the ActionScript object adapter 225
Verify that your code is correct
Your code should match the following code example. Verify that the content is correct and
save the lesson1.mxml file.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
height="100%" width="100%"
creationComplete="initApp();">
<mx:Script>
<![CDATA[
import mx.data.DataService;
import mx.data.events.*;
import mx.rpc.AsyncToken;
import mx.rpc.events.*;
import mx.messaging.events.*;
import mx.utils.ObjectProxy;
public var noteObj:Object = new Object();
public var getToken:AsyncToken;
private var ds:DataService;
[Bindable]
public var noteProxy:ObjectProxy;
public function initApp():void {
ds = new DataService("notes");
ds.addEventListener(ResultEvent.RESULT, resultHandler);
ds.autoCommit = false;
noteObj.noteId = 1;
noteObj.noteText =
"Type your notes here and share them with other clients!";
getToken = ds.getItem(noteObj, noteObj);
}
public function resultHandler(event:ResultEvent):void {
if (event.token == getToken)
noteProxy = ObjectProxy(event.result);
}
]]>
</mx:Script>
<mx:Binding source="log.text" destination="noteProxy.noteText"/>
<mx:TextArea id="log" width="100%" height="80%"
text="{noteProxy.noteText}"/>
<mx:Button label="Send" click="ds.commit();"/>
</mx:Application>
Vista de pagina 224
1 2 ... 220 221 222 223 224 225 226 227 228 229 230 ... 255 256

Comentarios a estos manuales

Sin comentarios