
Two years ago, I wrote a simple Google Maps collaboration example. The Flex application listened to Google Maps events to synchronize maps between different users. It also added nice collaboration features such as videoconferencing and a collaborative whiteboard overlaid on top of the map. In addition to demonstrating the real-time messaging capabilities of Flex, this application also illustrated Flex/Ajax integration using External Interface.
Two recent events prompted me to revisit this sample:
- Yahoo recently released an ActionScript 3 API for Yahoo Maps.
- Adobe recently released the Remoting and Messaging features of LiveCycle Data Services as an Open Source project named BlazeDS.
So, I updated the sample to work with the Yahoo Maps ActionScript API and BlazeDS (or LCDS). No need to communicate between Ajax and Flex in this version since the rendering of the map is entirely done within the Flex application.
Testing the hosted version
Disclaimer: I’m currently hosting the application on the server I use to host this blog (basic PHP and Tomcat hosting plan). I don’t know much about the characteristics of my server, but I’m probably sharing it with a few dozens of other domains and the resources allocated to me are obviously limited in that shared environment. This is clearly not the ideal environment to host a potentially large scale real time application and I’m investigating other hosting solutions. In the meantime, if you experience difficulties running the app, you can install it locally using the instructions provided below (in “Local installation instructions”). The hosted version tries to connect using RTMP by default (available only as part of LCDS) and falls back to “long AMF polling” or regular AMF polling if the RTMP connection fails.
- Access http://coenraets.org/maprooms/maprooms.html on two different machines or in two browser windows on the same machine.
- Make sure you logon with two different user names and the same room name.
- Move the map in one browser and notice that the position of the map is synchronized in the other browser.
- You can also search an address in one browser and the resulting map position will appear in the two browsers.
- The zoom level and the map type are also synchronized between users.
- Click the Map Sharing button in one browser, pick a color to draw on the map (upper left corner), and start drawing.
Note: you can right-click the application and select View Source or click here to see the source code of the application.
Local installation instructions:
- Install BlazeDS. You can download the BlazeDS turnkey server (a version of Tomcat with BlazeDS preinstalled) here.
- Open {blazeds-install-dir}/tomcat/webapps/samples/WEB-INF/flex/services-config.xml and add an AMF long polling channel defined as follows:
<channel-definition id="my-longpolling-amf" class="mx.messaging.channels.AMFChannel"> <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amflongpolling" class="flex.messaging.endpoints.AMFEndpoint"/> <properties> <polling-enabled>true</polling-enabled> <polling-interval-seconds>5</polling-interval-seconds> <wait-interval-millis>60000</wait-interval-millis> <client-wait-interval-millis>1</client-wait-interval-millis> <max-waiting-poll-requests>200</max-waiting-poll-requests> </properties> </channel-definition> - Open WEB-INF/messaging-config.xml and add the following destination:
<destination id="flexmaps"> <properties> <server> <allow-subtopics>true</allow-subtopics> <subtopic-separator>.</subtopic-separator> </server> </properties> <channels> <channel ref="my-longpolling-amf"/> <channel ref="my-polling-amf"/> </channels> </destination>
- (Re)start the BlazeDS turnkey server.
- Download the source code of the Yahoo Maps Application here.
- Create a Flex Builder project for the Flex application (maprooms). Make sure you configure your Flex Builder project to work with BlazeDS. To read instructions on how to set up a Flex Builder project that works with BlazeDS, make sure your BlazeDS turnkey server is started, and click here.
- Download the Yahoo Maps ActionScript 3 API here, and add YahooMap.swc in the libs folder of your project.
- Get a Yahoo API key here and assign it to the appid variable in MapArea.mxml.
- Compile the application.
- Open the Flex application in two browser windows (to simulate two users in different locations) and test the application as described above (in “Testing the hosted version”).


54 Comments
Very cool!
Christophe,
Thank you so much for publishing the source for your projects I have learned so much from them, especially your sqlAdmin and salesBuilder applications!
I look forward to learning more with your Yahoo maps project.
my firefox (2.0.0.13) is crashing every time I want to test it.
Well, I’ve done something wrong. I’m trying to get this to work with ColdFusion and LCDS. It gets the map, but the two windows don’t talk to each other. How do I tell that LCDS is running and getting the data?
Cool !
I’ve found a similar app a couple of days ago. It’s Google Maps Collaboration using Flex and BlazeDS.
http://www.banana-systems.com/MyFlight/view/Flight.html
Gee, it was such an easy fix. I had to add the ref to the destination in the WEB-INF/messaging-config.xml file.
Hi, I’m writing an article about Flex and Java for a commercial magazine and I was wondering whether can I use your Flex Test Drive Server (which is already configured) and put it on the magazine’s CD. Of course I can remove all .mxml files (and .java and rest of sources) you created for Flex Test Drive. I just neead a server working out-of-box.
Sorry for leaving this question on your blog. I didn’t found your e-mail address.
I can not get this working locally, I have successfully created the little chart example from the Blazeds dev doc.
I have followed letter by letter, but the two windows don’t talked to each other. What debugging tools do we have with Blazeds
Thanks
Little more insight, I getting a sandbox error too yahoo.
*** Security Sandbox Violation ***
Connection to http://us.maps2.yimg.com/us.tile.yimg.com/tl?x=4940&y=2112&z=4&v=4.1&locale=en&s=256 halted – not permitted from http://localhost:8400/maprooms//maprooms.swf
Sorry to flame your blog, great app, I got the demo to work on an external server (my production) any help or links on setting this up in dev environment with localhost, I assume proxy is needed
Thanks in advance
Thanks for the wonderful example.
One quick question: What is the right way to compile the codes with command line tools? I used “mxmlc maprooms.mxml” and got a swf file that does not run correctly. This swf file is different from the one compiled under Eclipse.
This is really nice example to communication between flex,Yahoo Map API and BlazeDS
It is perfectly working in Internet Explorer but in firefox when i run this firefox unexpectedly closing the browser.
Thanks,
Megharaja S.H.
I Want JAVA FLEX Meterial
excellent A+
Too Good example. Thanks
Hi thanks for the post.Nice blog.Now this blog is in my favourite bookmark pages.
http://www.squidoo.com/papershredderarticles
Yahoo Maps Collaboration using Flex and BlazeDS
Thank you very much for this information.
Too Good example. Thanks
Your tested on the hosted version doesn’t sync up the maps between 2 browser instances.
I set it up on my local computer and it behaves the same way, no sync between sessions.
Got any ideas?
How do I tell that LCDS is running and getting the data?
maskable scattered,Clio counteractive!…
I set it up on my local computer and it behaves the same way, no sync between sessions.
I getting a sandbox error too yahoo.
Вообще, когда читаешь такое, посещает мысль, а ведь это ж так просто, ну почему я это не смог придумать
Ну, как сказать, понравилось :) Хотя я все равно практически ничего не понял. :)
ulen rus sitesi olmuş burası bende az türkçe yazıyımda türklerinde varlğı belli olsun :D
selametle :D:D:D
Well, I’ve done something wrong. I’m trying to get this to work with ColdFusion and LCDS. It gets the map, but the two windows don’t talk to each other.
Christophe,
Thank you so much for publishing the source for your projects I have learned so much from them, especially your sqlAdmin and salesBuilder applications!
I look forward to learning more with your Yahoo maps project
Sorry to flame your blog, great app, I got the demo to work on an external server (my production) any help or links on setting this up in dev environment with localhost, I assume proxy is needed
Thanks in advance
Добротно сделано, контент порадовал, сам на многие блоги и не зашёл бы никогда…
красиво, сделал! Благодарю!!!
Распечатываю… на стенку в самое видное место!!!
Спасибо.
На сайте можно скачать последние фильмы бесплатно, на высокой скорости. Все фильмы разбиты по удобным категориям, а также по году выпуска.
This is great work. I add this my site.thanks
Спасибо!
Отличная информация!
Основная задача Яндекса — давать ответы на вопросы пользователей!
Thanks for this article…
thanks very good page and cool page
Привет. Образовалась проблема – купил я электродрель на магазин ру
А она сломалась у меня в тот ведь день – гарантии практически никакой не дали. Просто почта пришла с коробкой, а там все на китайском. Написал в магазин этот, дали ответ, что обращайтесь в сервис центр, хотя у меня ни документов на руках нет, ничего. Как можно приструнить данный интернет магазин? Есть ли какие-то компетентные органы, что писать. Куда писать, кому писать. Ошибся, да, нужно было в магазине нормальном прикупить, хотя необходимой мне модели просто не было, да и дешевле в интернет-магазине. А вот теперь сижу у разбитого корыта. Подскажите, что делать.
Кому это важно?
Интересно – случайно наткнулся на статью – не плохо.
Бе-е-е((( ну и мазня. По-другому назвать нельзя. Ушол в себя от такого занудства((((
Классная статья – спасибо!
Готов перечитать статью ещё раз. Хороший матерьял и написанно просто! ТО что надо.
В современной экономической ситуации все это рпеобретает несколько иной смысл – весьма смешной я бы сказал
Мне это пригодится.
рпеобретает несколько иной смысл – весьма смешной я бы сказал
locations) and test the application as described above (in “Testing the hosted version”).
16 Trackbacks
[...] Yahoo Maps Collaboration using Flex and BlazeDS [...]
[...] up, Cristophe Coenraets, re-releases his collaborarative mapping tool: The Flex application listened to Google Maps events to synchronize maps between different users. [...]
[...] Yahoo Maps Collaboration using Flex and BlazeDS [...]
[...] Yahoo Maps Collaboration using Flex and BlazeDS : Christophe Coenraets An good example of flex collaboration. [...]
[...] Yahoo Maps collaboration, here is another example of enabling collaboration in a Flex application using the [...]
[...] Coenraets hat seine interaktive Karten-Demo mit Flex nun auf die ActionScript 3 fähige Yahoo API upgedated, so dass man nun ohne AJAX auskommt (zuvor hatte die Demo Google Maps verwendet). Dadurch bleibt [...]
[...] recently posted a number of examples (Yahoo Maps Collaboration and Collaborative Data Entry) showing how to use the BlazeDS / LCDS Message Service to build [...]
[...] API for Flash. I took the opportunity to create a Google version of the MapRooms sample application I posted recently. MapRooms works like Chat Rooms. You can create a room, or join an existing one. In addition to [...]
Old ibuprofen….
Ibuprofen recall….
gambling odd…
maskable scattered,Clio counteractive!…
[...] Tour De Flex Application – insideria.com Developing .NET class – themidnightcoders.com Yahoo Maps Collaboration using Flex and BlazeDS – coenraets.org Integrating Flex into Ajax applications – ibm.com AOL Pictures and Flex – [...]
[...] Yahoo Maps Collaboration using Flex and BlazeDS – coenraets.org [...]
[...] Yahoo Maps Collaboration using Flex and BlazeDS – coenraets.org [...]
[...] Yahoo Maps [...]
[...] Yahoo Maps Collaboration using Flex and BlazeDS – coenraets.org [...]
[...] Yahoo Maps Collaboration using Flex and BlazeDS – coenraets.org [...]