1 Reply Latest reply on May 25, 2006 8:15 AM by jrunrandy

    Where is tutorials.zip file and completedx.mxml?

    GadgetGuruKen
      Hello,

      I am going through all of the lessons in the Flex2_Getting_Started.PDF file, and on page 191 where is begins talking about Data Services and the Data Management Service, the manual clearly references a tutorials.zip file containing completed1.mxml and completed2.mxml. I seem to be unable to find any of these files. Can someone please send them to me so that I can continue learning Flex2? Please e-mail them to ken@sivaraman.com.

      Many thanks,
      -Ken
        • 1. Re: Where is tutorials.zip file and completedx.mxml?
          jrunrandy Adobe Employee
          For some reason, the link to the download is broken. I'll get it fixed. For now, here are the files:

          completed1.mxml
          -------------------------
          <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;

          private 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="100%" text="{noteProxy.noteText}"/>
          <mx:Button label="Send" click="ds.commit();"/>

          </mx:Application>


          completed2.mxml
          ------------------------
          <?xml version="1.0" ?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
          creationComplete="initApp()">

          <mx:Script>
          <![CDATA[
          import mx.data.DataService;
          import mx.collections.ArrayCollection;
          import samples.contact.*;


          public var ds:DataService;

          [Bindable]
          public var contacts:ArrayCollection;

          public var contact:Contact;



          public function initApp():void
          {
          contacts = new ArrayCollection();
          ds = new DataService("contact");
          ds.fill(contacts);
          }
          ]]>
          </mx:Script>

          <mx:DataGrid id="dg" dataProvider="{contacts}" editable="true">
          <mx:columns>
          <mx:DataGridColumn dataField="contactId" headerText="Id" editable="false"/>
          <mx:DataGridColumn dataField="firstName" headerText="First Name"/>
          <mx:DataGridColumn dataField="lastName" headerText="Last Name"/>
          </mx:columns>
          </mx:DataGrid>
          </mx:Application>

          contact.as
          --------------
          package samples.contact
          {

          //These imports should be unnecessary in the final release
          import mx.data.IManaged;
          import mx.data.utils.Managed;
          import mx.core.mx_internal;

          [Managed]
          [RemoteClass(alias="samples.contact.Contact")]
          public class Contact
          {
          public var contactId:int;

          public var firstName:String = "";

          public var lastName:String = "";

          public var address:String = "";

          public var city:String = "";

          public var state:String = "";

          public var zip:String = "";

          public var phone:String = "";
          }
          }