Skip to main content
Mary Pieroszkiewicz
Known Participant
January 20, 2011
Question

My application: IIS7, ColdFusion, database MySQL, Flex 4, Google Map API

  • January 20, 2011
  • 5 replies
  • 2695 views

Hi

In defense of my diploma thesis I have to make application. The  project application is this: An application that allows you to  incorporate photos and map geolocation data read from the recording  device GPS position. The whole can for example play performed by our  tours, in addition to plotting the data entered by us. For this project I  want to use Google Map API. The concept of project is this: I would  like to send using ColdFusion to the database MySQL. GPS data and  photos. There is little material on the Internet to combine Adobe Flash  Builder (Flex 4) with ColdFusion.


Could you help me with my project?
Thank you!


Application similar to this:
http://www.txtracks.com/mt-bike-trails-map.cfm

http://mapmypix.com/



My source code Flex 4:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
     xmlns:s="library://ns.adobe.com/flex/spark"
     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
     xmlns:maps="com.google.maps.*">
    
     <fx:Script>
          <![CDATA[
               import com.google.maps.LatLng;
               import com.google.maps.MapEvent;
               import com.google.maps.MapType;
               import com.google.maps.controls.MapTypeControl;
               import com.google.maps.controls.ZoomControl;
               import com.google.maps.overlays.Marker;
               import com.google.maps.overlays.MarkerOptions;
              
               import mx.collections.ArrayCollection;
               import mx.rpc.events.ResultEvent;
              
               private function onMapReady(event:MapEvent):void
               {
                    map.setCenter(new LatLng(50.1790184, 18.9038037), 8,MapType.NORMAL_MAP_TYPE);
                    map.addControl(new ZoomControl);
                    map.addControl(new MapTypeControl);
                    service.send();
               }
              
               private function onResult(event:ResultEvent):void
               {
                    var list:ArrayCollection = event.result.map.loc;
                    for (var i:int=0; i<list.length; i++)
                    {
                         var m:Marker = new Marker(new LatLng(list.lat, list.lon),
                                                            new MarkerOptions({tooltip:list.name}));
                         map.addOverlay(m);
                    }
               }
          ]]>
     </fx:Script>
     <fx:Declarations>
          <s:HTTPService id="service" url="http://localhost/Application_1-debug/services/markersService.cfc" result="onResult(event)"/>
     </fx:Declarations>
    
     <maps:Map id="map"
                 key="ABQIAAAAYEnmmVuqT8hWQYzqt_vrUBTvyqiIex-9051tKK-jtQpGXvneuBTd0DxyoLadpNRbahLZlzpK5lSCdg"
                 width="100%" height="100%"
                 sensor="false"
                 mapevent_mapready="onMapReady(event)"/>
</s:Application>


Source code database MySQL

CREATE TABLE `markers` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 60 ) NOT NULL ,
`lat` FLOAT( 10, 6 ) NOT NULL ,
`lng` FLOAT( 10, 6 ) NOT NULL
) ENGINE = MYISAM ;

INSERT INTO google_map.markers (name, lat, lng) VALUES ('Mikolow', '50.1790184', '18.9038037');
INSERT INTO google_map.markers (name, lat, lng) VALUES ('Katowice', '50.2648919', '19.0237815');
INSERT INTO google_map.markers (name, lat, lng) VALUES ('Gliwice', '50.2944923', '18.6713802');
INSERT INTO google_map.markers (name, lat, lng) VALUES ('Chorzów', '50.2974884', '18.9545728');

I have configured IIS7 with ColdFusion 9.
I created a MySQL database.
I added it to the ColdFusion 9 server and then I configured it to Flex 4

Don't show me the markers on the map.

Regards

    This topic has been closed for replies.

    5 replies

    Mary Pieroszkiewicz
    Known Participant
    February 25, 2011

    Doesn't it will be easier for me everything in the Flex CallResponder parameter which will be combined using ColdFusion MySQL database?

    Just as it is shown here: http://www.adobe.com/devnet/flex/testdrive.html

    Mary Pieroszkiewicz
    Known Participant
    February 23, 2011

    I gave up the IIS7 and I installed ColdFusion 9 the WAMP. I have a question if I have installed ColdFusion 9 the WAMP is using RemoteObject + AMF in the file: ColdFusion9/wwwroot/WEB-INF/flex/services-config

    Do I need to change here and enter: http://localhost:80/flex2gateway/

    <channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">
                 <endpoint uri="
    http://{server.name}:{server.port}{context.root}/flex2gateway/" class="coldfusion.flash.messaging.CFAMFEndPoint"/

    Inspiring
    January 20, 2011

    I was able to find many resources to help with connecting Flex to

    ColdFusion, in addition to the Adobe documentation.

    RemoteObject has worked the same for many versions of Flex, so if you find

    older tutorials on Flex 3 don't ignore them. Flex 4 syntax (namespaces)

    have changed but lessons from Flex 3 should apply well to Flex 4.

    Also Flash Builder 4 is the newer version of Flex Builder 3, and it was

    renamed by Adobe for marketing purposes. If you find resources regarding

    Flex Builder then don't ignore that either since Flash Builder is just a

    revision of Flex Builder.

    Here are some examples I found that might help:

    http://www.eonflex.com/?p=276

    http://www.adobe.com/devnet/flex/videotraining/exercises/ex3_04_remote.html

    http://sherifabdou.com/2008/06/flex-and-coldfusion-remoting-simple-database-example/

    http://sherifabdou.com/2008/06/populating-a-datagrid-in-flex-from-a-coldfusion-database/

    http://blogs.adobe.com/flexdoc/2007/02/hello_world_application_for_fl_1.html

    http://howardscholz.wordpress.com/2007/07/02/handling-results-in-flex-from-remoteobject-calls-in-coldfusion/

    http://my.safaribooksonline.com/book/programming/flex/00120090003si/using-remoteobject-components/sample_remoteobject_applicatio#X2ludGVybmFsX0ZsYXNoUmVhZGVyP3htbGlkPTAwMTIwMDkwMDAzU0kvMTE2Mg==

    Twitter is also a good place to find help for ColdFusion for very specific

    questions. Use the #coldfusion hashtag.

    Mary Pieroszkiewicz
    Known Participant
    January 20, 2011

    Steven Erat Thank you!

    I just start the adventure with Adobe Flex and Adobe ColdFusion. And I have to write at the end of study was the application. My supervisor said that I use ColdFusion as a connection to the MySQL database. Most tutorials on the Internet is Flex with PHP. But I have to do is Flex with ColdFusion.

    So I'm looking for help.

    Community Expert
    January 20, 2011

    Several of Steven's links specifically cover using Flex with ColdFusion via Flash Remoting (AMF), Read those, and try building those code examples. Then, follow up here with specific questions if you have further problems.

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Dave Watts, Eidolon LLC
    Inspiring
    January 20, 2011

    I recommend you divide the problem in to parts, and solve each part before

    trying to combine them into one comprehensive application.

    To begin, you might want to review this documentation which is specifically

    about using RemoteObject in Flex 4 to connect to ColdFusion server that has

    a MySQL datasource.

    http://help.adobe.com/en_US/Flex/4.0/AccessingData/WS2db454920e96a9e51e63e3d11c0bf69084-7fda.html

    1) First, make sure that the ColdFusion/MySQL application side is working

    well by creating a simple HTML test that does basic CRUD operations (create,

    read, update, delete). You can encapsulate the data access functionality in

    a CFC object, then interact with the CFC from a plain form page (using

    creatobject or cfinvoke as you prefer).

    2) Then continue by creating a simple Flex application that does NOT use

    Google maps. Just use RemoteObject to connect to the ColdFusion server to

    call the data access CFC. In the onResult handler, assign the result to a

    Datagrid and just display the data for viewing. Nothing sophisticated yet.

    3) Then try adding additional logic that accepts changes to the data from

    the grid and sends the changes to the ColdFusion data access CFC. Maybe a

    Flex form that allows you enter a City & Lat & Long, submit data to CF,

    fetch fresh data from CF (or fetch a flag that the INSERT was successful),

    and redisplay the revised data in the data grid.

    4) Finally, begin adding the Google Map API to the application to perform

    the actual mapping.

    I think that you will be more successful by solving small problems, then

    combining what you have learned into the final project.

    To help with problems when things don't work, you should use Flex's tracing

    options and ColdFusion's trace/cflog options. And to help examine the data

    transmission between Flex and ColdFusion, there is a popular tool called

    Charles which can allow you to inspect the ActionScript objects sent over

    the AMF protocol used by Flex's RemoteObject.

    If you have specific problems, post as much information as possible to the

    forums for additional help.

    Good luck!

    Inspiring
    January 20, 2011

    <fx:Declarations> <s:HTTPService id="service"

    url="http://localhost/Application_1-debug/services/markersService.cfc"

    result="onResult(event)"/> </fx:Declarations>

    1st off i'd use RemoteObject instead of a HTTP service. don't know what that CFC

    is returning but pretty sure it's not an ArrayCollection via HTTP.