2 Replies Latest reply on Sep 6, 2007 2:28 PM by ashar2005

    coldfusion and flex intergration

    stinasius
      hi guys i was trying out a tutorial of coldfusion and flex intergration but i keep geting errors. here is my code please direct me on what to do.

      "ArtCatalog.mxml"
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" creationComplete="InitApp()">
      <mx:Script>
      <![CDATA[

      public function InitApp(): void
      {
      artSvc.GetArtists();
      }
      ]]>
      </mx:Script>
      <mx:RemoteObject id="artSvc" destination="ArtCatalog" source="websoft.artcatalog.art" showBusyCursor="true" />
      <mx:VBox x="199" y="373" width="100%" height="100%" horizontalCenter="0" paddingLeft="0" paddingRight="0" top="0">
      <mx:FormItem label="Artist:">
      <mx:ComboBox id="artistsCB" dataProvider="{artSvc.GetArtists.result}" width="150" change="{artSvc.GetArt(artistsCB.selectedItem.data)}"/>
      </mx:FormItem>
      <mx:HBox width="100%" height="100%">
      <mx:DataGrid width="100%" height="100%" id="artGrid" dataProvider="{artSvc.GetArt.result}">
      <mx:columns>
      <mx:DataGridColumn headerText="Name" dataField="artname"/>
      <mx:DataGridColumn headerText="Description" dataField="description"/>
      <mx:DataGridColumn headerText="Sold" dataField="issold"/>
      <mx:DataGridColumn headerText="Price" dataField="price"/>
      </mx:columns>
      </mx:DataGrid>
      <mx:Panel title="{artGrid.selectedItem.artname}">
      <mx:Image height="200" width="200" source="{artGrid.selectedItem.image }" />
      </mx:Panel>
      </mx:HBox>
      </mx:VBox>
      </mx:Application>

      "art.cfc"
      <cfcomponent>


      <!--- Get artists --->
      <cffunction name="GetArtists" access="remote" returntype="query" output="false">

      <cfset var artists="">
      <cfset var result="">

      <cfquery datasource="cfcodeexplorer" name="artists">
      SELECT lastname, firstname,
      artistid
      FROM artists
      ORDER BY lastname, firstname
      </cfquery>
      <cfquery dbtype="query" name="results">
      SELECT firstname AS label, artistid AS data
      FROM artists
      ORDER BY label
      </cfquery>

      <cfreturn results>

      </cffunction>


      <!--- Get art for specified artist --->
      <cffunction name="GetArt" access="remote" returntype="query" output="false">
      <cfargument name="artistid" type="numeric" required="yes">

      <cfset var art="">
      <cfset var result="">

      <cfquery datasource="cfcodeexplorer" name="art">
      SELECT artid, artname, description, issold,
      largeimage, mediaid, price
      FROM art
      WHERE artistid=<cfqueryparam value="#ARGUMENTS.artistid#"
      cfsqltype="cf_sql_numeric">
      ORDER BY artname
      </cfquery>
      <cfquery dbtype="query" name="results">
      SELECT artid, artname, description, issold,
      ' http://localhost:8501/cfide/gettingstarted/tutorial/images/' + largeimage AS image,
      mediaid, price
      FROM art
      ORDER BY artname
      </cfquery>

      <cfreturn results>

      </cffunction>


      </cfcomponent>

      "services-config.xml"
      <?xml version="1.0" encoding="UTF-8"?>
      <services-config>

      <services>
      <service id="coldfusion-flashremoting-service"
      class="flex.messaging.services.RemotingService"
      messageTypes="flex.messaging.messages.RemotingMessage">

      <adapters>
      <adapter-definition id="cf-object" class="coldfusion.flash.messaging.ColdFusionAdapter" default="true"/>
      </adapters>

      <destination id="ColdFusion">
      <channels>
      <channel ref="my-cfamf"/>
      </channels>
      <properties>
      <source>*</source>
      <!-- define the resolution rules and access level of the cfc being invoked -->
      <access>
      <!-- Use the ColdFusion mappings to find CFCs, by default only CFC files under your webroot can be found. -->
      <use-mappings>false</use-mappings>
      <!-- allow "public and remote" or just "remote" methods to be invoked -->
      <method-access-level>remote</method-access-level>
      </access>

      <property-case>
      <!-- cfc property names -->
      <force-cfc-lowercase>false</force-cfc-lowercase>
      <!-- Query column names -->
      <force-query-lowercase>false</force-query-lowercase>
      <!-- struct keys -->
      <force-struct-lowercase>false</force-struct-lowercase>
      </property-case>
      </properties>
      </destination>

      <destination id="ArtCatalog">
      <channels>
      <channel ref="my-cfamf"/>
      </channels>
      <properties>
      <source>websoft.artcatalog.art</source>
      <lowercase-keys>true</lowercase-keys>
      </properties>
      </destination>

      </service>
      </services>

      <channels>
      <channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">
      <endpoint uri=" http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>
      <properties>
      <polling-enabled>false</polling-enabled>
      <serialization>
      <instantiate-types>false</instantiate-types>
      </serialization>
      </properties>
      </channel-definition>
      </channels>

      <logging>
      <target class="flex.messaging.log.ConsoleTarget" level="Error">
      <properties>
      <prefix>[Flex] </prefix>
      <includeDate>false</includeDate>
      <includeTime>false</includeTime>
      <includeLevel>false</includeLevel>
      <includeCategory>false</includeCategory>
      </properties>
      <filters>
      <pattern>Endpoint.*</pattern>
      <pattern>Service.*</pattern>
      <pattern>Configuration</pattern>
      <pattern>Message.*</pattern>
      </filters>
      </target>
      </logging>

      <system>
      </system>

      </services-config>

        • 1. Re: coldfusion and flex intergration
          stinasius Level 1
          hey guys i hope i am not making you crazy with my problems. i am new to flex and i am trying to use coldfusion 8 with flex 2 builder to develop some applications and even to try out some of the flex samples like phone selector but i keep getting the same actionscript errors. i serious dont know what to do.can a good samaritan please look at this error and prescribe a solution that will work for me?Note: i have to coldfusion versions mx 7 and 8 running on my system and cf8 uses port 8501 and mx7 uses 8500.please guys here is the error i keep getting and i am almost giving up on flex.Help!!!!!!!!! please help!!!!!!!!!!!!!

          "actionscript error"
          VerifyError: Error #1053: Illegal override of subtopic in mx.messaging.Consumer.
          at flash.display::MovieClip/nextFrame()
          at mx.managers::SystemManager/::deferredNextFrame()
          at mx.managers::SystemManager/::preloader_initProgressHandler()
          at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at mx.preloaders::Preloader/::timerHandler()
          at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
          at flash.utils::Timer/flash.utils:Timer::tick()
          TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at mx.managers::SystemManager/::docFrameHandler()
          • 2. Re: coldfusion and flex intergration
            ashar2005
            If you are not actually using messaging (producer/consumer) stuff, you can get rid of that
            problem by going to your project properties and in the Library paths, remove the line referring
            to fds.swc.

            If you ARE actually using messaging, you may get another issue, "FlexClient support" similar to what I am dealing with.