3 Replies Latest reply on Jul 9, 2010 7:39 AM by TomCoppock

    DataService with Flex

    Rafael Viana

      Hello,

       

      I'm testing the DataService with LCDS and I'm experiencing some problems.

      I built an AIR application and it works fine.I used this same code to built a Flex application but when I compile the Flex app the player throws me an error:

       

      ReferenceError: Error #1065: Variable mx.data::LocalStoreFactory is not defined.
          at mx.data::DataStore()[C:\depot\DataServices\trunk\frameworks\projects\data\src\mx\data\Dat aStore.as:219]
          at mx.data::DataStore$/http://www.adobe.com/2006/flex/mx/internal::getSharedDataStore()[C:\depot\DataServices\tru nk\frameworks\projects\data\src\mx\data\DataStore.as:1866]
          at mx.data::ConcreteDataService/get dataStore()[C:\depot\DataServices\trunk\frameworks\projects\data\src\mx\data\ConcreteData Service.as:522]
          at mx.data::ConcreteDataService/set channelSet()[C:\depot\DataServices\trunk\frameworks\projects\data\src\mx\data\ConcreteDat aService.as:285]
          at mx.data::DataService/set channelSet()[C:\depot\DataServices\trunk\frameworks\projects\data\src\mx\data\DataService .as:354]
          at <anonymous>()[D:\Trabalho\Pesquisa\CRM\src\Teste.mxml:14]
          at Function/http://adobe.com/AS3/2006/builtin::call()
          at mx.binding::Binding/innerExecute()[C:\autobuild\3.2.0\frameworks\projects\framework\src\m x\binding\Binding.as:375]
          at Function/http://adobe.com/AS3/2006/builtin::apply()
          at mx.binding::Binding/wrapFunctionCall()[C:\autobuild\3.2.0\frameworks\projects\framework\s rc\mx\binding\Binding.as:287]


      I didn't find in the Google some problem like this.Someone can help me?

       

      How can I use the DataService with the Flex without errors?

        • 1. Re: DataService with Flex
          esklein1

          Can you copy your code?

           

          It looks as if your managed array is not actually created?

          • 2. Re: DataService with Flex
            Umal Kumar Adobe Employee

            Are the classes which are defined in your app public, if not set the classes declaration to public and see if this resolves the issue.

            • 3. Re: DataService with Flex
              TomCoppock

              Sounds like you are missing some library entries. Are you compiling using Flash Builder or mxmlc?

               

              If you are using mxmlc, a good tip is to view the .actionScriptProperties file in the Flash Builder (Eclipse) project directory to see the compiler settings that FlashBuilder is using.

               

              I'm using Ant to compile my combined Java/Flex LCDS app. The portion of the ant script to do the compilation is reproduced below - note the library-path settings (make sure all these are included to avoid the problem you are describing).

               

              Hope this helps!

               

               

                     <!-- =================================================================== -->
                     <!-- Compile Flex target                                                       -->
                     <!-- =================================================================== -->
                     <target name="compile_flex" depends="init" description="Compiles Flex code">
                         <delete dir="${project.flexbin}"/>
                         <mkdir dir="${project.flexbin}"/>
                      <java jvm="${jdk.home}/bin/java"
                          jar="${FLEX_HOME}/lib/mxmlc.jar"
                             fork="true"
                          failonerror="true">
                          <arg value="+flexlib=${FLEX_HOME}/frameworks"/>
                          <arg value="-file-specs=${project.flexsrc}\${project.flexappname}.mxml"/>
                          <arg value="-output=${project.flexbin}\${project.flexappname}.swf"/>
                          <arg value="-context-root=/${project.name}"/>
                          <arg value="-keep-generated-actionscript=true"/>
                          <arg value="-compiler.library-path+=${eclipse.workspace}${project.name}/WebContent/WEB-INF/fle x/libs"/>
                          <arg value="-compiler.library-path+=${eclipse.workspace}${project.name}/WebContent/WEB-INF/fle x/libs/fds.swc"/>
                          <arg value="-compiler.library-path+=${eclipse.workspace}${project.name}/WebContent/WEB-INF/fle x/libs/player/playerfds.swc"/>
                          <arg value="-compiler.library-path+=${eclipse.workspace}${project.name}/WebContent/WEB-INF/fle x/locale/{locale}"/>
                          <arg value="-services=${eclipse.workspace}${project.name}/WebContent/WEB-INF/flex/services-con fig.xml"/>    
                      </java>
                      <!-- Copy the compiled file to the web app directory -->
                      <copy file="${project.flexbin}/${project.flexappname}.swf" tofile="${project.websrc}/${project.flexappname}.swf" overwrite="true" />
                      <!-- Generate the HTML wrapper for the swf -->
                      <html-wrapper
                          title="Welcome to ${project.flexappname}"
                          file="${project.flexappname}.html"
                          height="600"
                          width="800"
                          bgcolor="blue"
                          application="app"
                          swf="${project.flexappname}"
                          version-major="9"
                          version-minor="0"
                          version-revision="0"
                          history="true"
                          output="${project.websrc}"/>   
                         <!--
                         Copy the data model - simulates the Flash Builder - "Deploy Model to LCDS Server" Function
                         -->
                         <copy todir="${project.websrc}/WEB-INF/datamodel" overwrite="true" >
                             <fileset dir="${eclipse.workspace}/${project.name}/.model" includes="**/*.fml"/>
                         </copy>
                         <!-- remove the first line from the copied file -->
                         <replace dir="${project.websrc}/WEB-INF/datamodel" value="">
                           <include name="**/*.fml"/>
                           <replacetoken><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]></replacetoken>
                         </replace>
                  </target>