Expand my Community achievements bar.

DataService with Flex

Avatar

Level 1

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\DataStore.as:219]
    at mx.data::DataStore$/http://www.adobe.com/2006/flex/mx/internal::getSharedDataStore()[C:\depot\DataServices\trunk\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\ConcreteDataService.as:522]
    at mx.data::ConcreteDataService/set channelSet()[C:\depot\DataServices\trunk\frameworks\projects\data\src\mx\data\ConcreteDataService.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\mx\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\src\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?

3 Replies

Avatar

Level 1

Can you copy your code?

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

Avatar

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.

Avatar

Level 1

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/flex/libs"/>
            <arg value="-compiler.library-path+=${eclipse.workspace}${project.name}/WebContent/WEB-INF/flex/libs/fds.swc"/>
            <arg value="-compiler.library-path+=${eclipse.workspace}${project.name}/WebContent/WEB-INF/flex/libs/player/playerfds.swc"/>
            <arg value="-compiler.library-path+=${eclipse.workspace}${project.name}/WebContent/WEB-INF/flex/locale/{locale}"/>
            <arg value="-services=${eclipse.workspace}${project.name}/WebContent/WEB-INF/flex/services-config.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>