2 Replies Latest reply on Jul 11, 2009 8:41 AM by meshgraphics

    flex 4.. newbie question... salesforce

    mr_payne Level 1

      Hi,  newbie question...

       

      im having a look at the new flash builder (flex 4).  im using the example code found here


      im trying to change it to workon the new flex sdk?

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication xmlns:s="library://ns.adobe.com/flex/spark"
                             xmlns:fx="http://ns.adobe.com/mxml/2009"
                             xmlns:salesforce="http://www.salesforce.com/"
                             xmlns:mx="library://ns.adobe.com/flex/halo"
                             applicationComplete="windowedapplication1_applicationCompleteHandler(event)">
          <fx:Script>
          <![CDATA[
             
              import com.salesforce.results.LoginResult;
              import com.salesforce.results.QueryResult;
              import com.salesforce.AsyncResponder;
              import com.salesforce.objects.LoginRequest;
              import mx.events.FlexEvent;
             
              protected function windowedapplication1_applicationCompleteHandler(event:FlexEvent):void
              {
                  var lr:LoginRequest = new LoginRequest();
                  lr.username = "admin@rmarples.dev";
                  lr.password = "usetheforce2010";
                  lr.callback = new AsyncResponder(loginSuccess);
                  force.login(lr);
              }
             
             
             
              private function loginSuccess(result:LoginResult):void
              {
                  force.query("SELECT Id, LastName FROM Contact", new AsyncResponder(querySuccess));
              }
             
              private function querySuccess(result:QueryResult):void
              {
                  grid.dataProvider = result.records;
              }
          ]]>
          </fx:Script>
         
         
          <salesforce:Connection id="force"/>
         
         
          <mx:smileyvery-happy:ataGrid id="grid" width="400" height="300"/>
         
      </s:WindowedApplication>

       

       

       

      problem is with this line  <salesforce:Connection id="force"/>

      error:  In initializer for 'mxmlContentFactory', type com.salesforce.Connection is not assignable to target Array element type mx.core.IVisualElement.

       

       

      any idea?

       

      thanks