Google Maps embedded in Flash
Hi,
Just wondering if it's at all possible to embedd an interactive Map supplied by Google Maps, that uses the following code to display the map:
<iframe width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Swansea,+UK&sll=37.0625,-95.67 7068&sspn=49.357162,79.013672&ie=UTF8&split=0&t=k&ll=51.620361,-3.946495&spn=0.063948,0.10 2997&z=12&iwloc=A&output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&source=embed&hl=en&geocode=&q=Swansea,+UK&sll=37.0625,-95. 677068&sspn=49.357162,79.013672&ie=UTF8&split=0&t=k&ll=51.620361,-3.946495&spn=0.063948,0. 102997&z=12&iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>
Ah ha, found a tutorial on Google itself, they've thought of everything!
Anyone else pondering this questions simply google "google maps and flash"
Similar Messages
-
Can't print Google Maps embedded in iWeb 08 pages
I have created a web page using iWeb 08; the page has several Google maps embedded. I realize that the Google maps are interactive but I can't find a way to print the web page showing the Google maps. When I print, I get blank space where the maps are. I've tried printing from Safari, iWeb and via PDF but none of these methods print the map as shown on the screen. Is there a way to do this?
Thanks for any help.
JamesYou cannot.
It's the way Apple embeds the map in the page.
Solution: Go to Google Maps, find your location, copy the HTML Embed code and paste it with the HTML Snippet.
Next problem: When printing the page, I see scroll bars on the printed page.
Problems, problems problems, will it ever stop.
[Send a feedback|http://www.apple.com/feedback/iweb.html] -
function displayMap(e) {
var title = e.data.title,
latlng = e.data.lat + ',' + e.data.lng;
if (typeof device !='undefined' && device.platform.toLowerCase() == 'android') {
window.location = 'http://maps.google.com/maps?z=16&q=' + encodeURIComponent(title) + '@' + latlng;
} else {
$('#map h1').text(title);
$('#map div[data-role=content]').html('<img src="http://maps.google.com/maps/api/staticmap?center=>' + latlng + ' &zoom=16&size=320x420&markers=' + latlng + '&sensor=false">');
$.mobile.changePage('#map', 'fade', false, true);
my phonegap (Adobe press, Powers jQuery with dw 5.5) book (old book (c)2010-11) says for above code: // is this valid for today, is this the right to use or for iOS can use dynamic google maps embeded(can be embedded fo iOS)???
On iOS, calling window.location loads the map directly
into the app. That’s great until you realize that iOS devices
don’t have a Back button, so there’s no way to exit the
map. To get round this problem, I loaded a static map as
an image in the map page block. It’s not interactive, but at
least you can continue using the Travel Notes app after
viewing the map by clicking the Back button generated by
jQuery Mobile.Well, this took me a while to get solved, but it is indeed solved.
I tried USB Overdrive and it could, and perhaps should work, but apparently it will not. When adding a device, it seems that USB Overdrive is not set up to handle any input device that does not register itself as either a Mouse or a Joystick. The VEC USB Footpedal that I'm using is "Device type: Other".
So, I went for Quickeys. And Quickeys can do it all. It did recognize the device, I was able to assign it to the scope of the particular audio playback app I wanted to use (Amazing Slow Downer OS X - which is truly amazing. Any musicians reading this who are looking for a way to learn pieces by ear, this does it better than anything else I've seen yet).
I created a shortcut in Quickeys for the ASD app; added the middle button of the foot pedal as the trigger; set one step, entering 'space bar' as the step (which toggles playback, similar to many audio players).
It all worked.
Quickeys is very confusing and seemingly featured with an endless array of options. Enter at your own risk. Ask me for help. This was the only way to get it done that I could find. I did write to the author of USB Overdrive asking him to please support additional devices as I did find some traction from gamers who like to use a foot pedal in addition to other input devices. There was a Windows-only management utility for the foot pedal that was intended for custom input, assigning the buttons to any keyboard input or mouse click event. It would be nice to have a simple and easy to use utility like this. But, Quickeys did do the job.
Thanks for your help, you guys!!! -
Google Maps API for flash not working on real device iPad
I use flash builder 4.5.1 to build app for Google Maps API for iOS (map_flex_1_20.swc), and it is working well even on the simulator on PC, but after I generate the IPA use FB4.5.1, and install on iPad , it not working at all, only show a while screen.(I used the TabbedViewNavigatorApplication, the botton Tabbar is working, I can switch the page, but on the maps page show nothing)
I also try the code on Flash CS5.5 using map_1_20.swc , when on the PC debug, it works well,(swf files), but install the AIR ipa on the iPAD, show nothing only a white sceeen.
anyone met this problem?You can also use the MapQuest Mobile Flash Maps API. It's supported by MapQuest and does not need any work-arounds in order to work with the Flash Platform. It also takes advantage of the "build once, deploy anywhere" functionality in Flex 4.5+. MapQuest provides a demo app for Android and iOS and has the source code available for download, too.
-
Migration of Google Maps Javascript to Flash
Hi, I am trying to gather information on how to migrate a heavily Google Maps based website
Mapped Travel from pure Javascript to Flash. I was wondering if there is a good migration guide out there, if there are any limitations (performance, compatibility, functionality, etc.)? Maybe there are even scripts to help me automate the migration? Thanks for any comments, RalphYou use ExternalInterface.addCallback to enable calling a function from JS.
Here, this tutorial has everything you need: http://www.viget.com/inspire/bi-directional-actionscript-javascript-communication -
Google map embeding problem for Indesign CC
Hi All,
I am having problem with embeding map to a indesign CC page.
- In Object menu I select "Insert HTML.."
- Edit HTML box appears, I paste the code into the box.
* text box appears says "This is an HTML Snippet"
- I select map code
122.79779808995053!3d49.02417660939079!3m2!1i1024!2i768!4f13.1!3m3!1m2!
1s0x5485c3820f643043%3A0x7d3de73b4af7e79f!2sWhite+Rock+Library!5e0!3m2!
1sen!2sca!4v1393030057275"width="600" height="450" frameborder="0"style="border:0"></iframe>
After I paste error message:
" JavaScript Error encountered while loading HTML"
Do I need script, if so where can I get it.
Please help!!!
atamtan
PS. I use same codes for Adobe muse no problem.Hi,
I tried did not work, I thought may be the page or document damaged, re
installed the InDesign, and tried with new documents, still same answer.
Thank you for the suggestion. -
Can you insert a google map in flash?
I was wondering
how I could insert a google map in a
flash app and preserve the interactive aspects of the google map?
Thank you for the help.yes, for as3, there's an api for flash. check the google docs.
for as2, you can purchase (or they may be a free) google component or, use javascript and the flash externalinterface class. -
When I try to view a page that has a Google map embedded on the page, I get the error message "a plugin is needed to display this content". However, I don't know what plugin, where to get it, etc. I've tried searching for this issue but haven't been able to come up with anyone else experiencing a similar issue, nor does there seem to be a plugin for Google Maps that I can find.
The page is here:
http://osiama.org/lodges#
The map displays when one of the links is clicked in the table.I'm not sure why, but the site uses <embed> for the map instead of <iframe>.
When Firefox wants to render an <embed>, it needs to know what type of object is being embedded, and the site doesn't supply that information, so you see a generic "I don't know how to handle this" error.
Unfortunately, I don't think there is a quick workaround for you as the end user. If you are the type to tinker, you can manually edit the code of the page in the web console as follows:
* right-click the plugin message and choose Inspect Element (Q) - the web console will open to the Inspector, with the <embed> element selected (screen shot #1)
* double-click embed and edit it to iframe, then press Enter to finish the edit
* Firefox will now load the map (screen shot #2)
This isn't a general fix-all for plugin errors, and ultimately the site will need to change this. -
Hi friends,
I am trying to put a google map into my flash website or
aplication. If someone can help me, it will be helpful to me to
finish my project, i got struct up.. pls...
i want to insert some particular place maps in flash
application. like while click on contact location, i want to show
my flash application map. or embed in my web page.
Thanks in advance,
RahimhajiHello, did you have any success getting google maps in Flash.
the google maps api exist now, I am having problems positioning the
map on specific co-ordinates on my stage - any ideas?
Richard -
Google maps for flash been Deprecated !
Hello. i just wana notify the comunity about a serious step tooken from google to kill the maps for flash, because seems like they can not handle them.
I would like to hear Adobe opinion - can Adobe do their developers a favor and asign a programmers to took close deal with google and continue the maps for flash ?
This is not a simple issue, it will be a vital for the future development of many things connected to Adobe and Google.
Please consider the question carefully.http://code.google.com/apis/maps/documentation/flash/
"Note: The Google Maps API for Flash has been officially deprecated as of September 2, 2011. The API will continue to work as per ourdeprecation policy, but we encourage you to migrate your applications to version 3 of the Maps JavaScript API."
The statement is perfectly LOL.
And seems like google can not pay 2-3 more developers to took care for thoose API,
The forum comunity related to this API vould like to ask if can Adobe took care on it because they have proven as a good team of developers already. -
Hi all,
Is there an easy way of embeding a movable google maps in Flash CS6 using AS2. The Google Maps API for flash won't provide anyone with new API keys anymore. I wondering if there is a way to use an HTML iframe in flash as then I would be able to somply embed the map in my Flash document using the code that google gives you.
Thanks in advanceyou should be able to use the javascript api with actionscript's externalinterface to use google maps and as2.
-
Good day all!
I've been trying to add the google map to a flash site. I've
got it on there but it's in the wrong place it sits on the top of
the page and I need it to be centered. Under the logo and nav bar.
You can see it here>
http://thedesignport.com/Doughboys/Location_Page.html
Any help? And I would like to add a from/ to search. Can't
find anything that helps online.
Thanks all!Hello, I am having a similar positioning issue - did you ever
figure this one out?
Please let me know how, thanks
Richard -
How to load the google map into an empty movieclip
how to load the google map into an empty movieclip ? Thank you
if you're using as3, check the google maps api for flash. if you're using as2, check the google maps api for javascript and use the externalinterface class in flash.
-
Error on Google maps simple map with Flex3
I have the following message ; "Initialization failed: please
specify an API key"
when I try to run the first sample that i found on Google
Maps API for Flash Tutorial ; link below
http://code.google.com/apis/maps/documentation/flash/basics.html
Google explains that when you run on your own computer, you
don't need the key.
I tried it on flex3 and Air with the same error message.
May somebody explain what i do wrong ?
Excuse my english because I'm frenchHi. Are you running your example on a local web server or
just from the file system? Even when specifying a correct key for a
local virtual host in apache, I get:
Initialization failed: please check the API key,
swf location, version and network availability.
I am using Map.key="mykey" -
Hi,
I am currenly developing application implementing Google Map sharing with Adobe LCCS and Flex for Android. I have a problem building the shared model of the google map, is there anyone who could show me any example regarding this as I could'nt found any. Any help is appreciated. Thx.
Regards
TanI didn't manage to get the Yahoo Map example running, so I went through it to get the important script to build the google map sharing. My source folder has only 3 files which i think suppose to be able to generate the Google Map.I login straight using my developer account.Below is the full list of log messages and I attached along the three scripts I've written...
Log messages:
[SWF] GoogleMap.swf - 2,651,420 bytes after decompression
Tue Mar 8 04:56:58 GMT+0800 2011 LCCS SDK Version : 1.3.7.1 Player Version : WIN 10,1,85,3
04:56:58 GMT+0800 requestInfo https://collaboration.adobelivecycle.com/yytan1987/myfirstroom?mode=xml&glt=g:&x=0.5164360 296912491
[SWF] /mapsapi/publicapi - 4,125 bytes after decompression
[SWF] /mapfiles/lib/map_1_20.swf - 317,303 bytes after decompression
[SWF] /mapsapi/publicapi - 790 bytes after decompression
04:57:08 GMT+0800 authentication status: 200
04:57:08 GMT+0800 authentication request complete
04:57:08 GMT+0800 requestInfo https://collaboration.adobelivecycle.com/yytan1987/myfirstroom?gak=cmVuZ2EqbmExcioxMmU5MjF iZjY0MSpKRDVETTdBM1pON1NTQVQwN0JWUjBCNTY5Qw==&mode=xml&x=0.6678212475962937
04:57:11 GMT+0800 #TicketService# ticket received: 26tkbnwc3t7z
04:57:11 GMT+0800 Getting FMS at https://na2.collaboration.adobelivecycle.com/fms?ticket=26tkbnwc3t7z&proto=rtmfp, attempt #1/3
04:57:12 GMT+0800 result: <fms>
<origin>fms2.acrobat.com</origin>
<proto_ports>rtmfp:1935,rtmps:443</proto_ports>
<retry_attempts>2</retry_attempts>
</fms>
04:57:12 GMT+0800 protocols: [object ProtocolPortPair],[object ProtocolPortPair]
04:57:12 GMT+0800 [attempt 1 of 2] Connecting to 0/1: rtmfp://fms2.acrobat.com/cocomo/na2-sdk-de21bd7d-e997-46a3-b4a2-33bf56efa416/myfirstroom #startProtosConnect#
04:57:14 GMT+0800 tempNetStatusHandler 0/2,NetConnection.Connect.Success
04:57:14 GMT+0800 isTunneling? false
04:57:14 GMT+0800 is using RTMPS? false
04:57:14 GMT+0800 RECEIVED LOGIN AT SESSION
04:57:14 GMT+0800 .user descriptor from server [object]
04:57:14 GMT+0800 \\
04:57:14 GMT+0800 .role [number]= 100
04:57:14 GMT+0800 .affiliation [number]= 100
04:57:14 GMT+0800 .userID [string]= WCD-2A9F0D364CAC939C0A746C1B/6
04:57:14 GMT+0800 .displayName [string]= YY Tan 6
04:57:15 GMT+0800 RECEIVENODES UserManager
04:57:15 GMT+0800 receiveAllSynchData UserManager
04:57:15 GMT+0800 RECEIVENODES FileManager
04:57:15 GMT+0800 receiveAllSynchData FileManager
04:57:15 GMT+0800 checkManagerSync:[object FileManager]
04:57:16 GMT+0800 RECEIVENODES AVManager
04:57:16 GMT+0800 receiveAllSynchData AVManager
04:57:16 GMT+0800 checkManagerSync:[object StreamManager]
04:57:16 GMT+0800 RECEIVENODES RoomManager
04:57:16 GMT+0800 receiveAllSynchData RoomManager
04:57:16 GMT+0800 checkManagerSync:[object RoomManager]
04:57:16 GMT+0800 checkManagerSync:[object UserManager]
04:57:17 GMT+0800 RECEIVENODES sharedMap
04:57:17 GMT+0800 receiveAllSynchData sharedMap
Error: MessageManager.getRootUserRole - This user doesn't exist.
at com.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::getRootUserRole()[/Users/arun /Work/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10/src/ com/adobe/rtc/messaging/manager/MessageManager.as:454]
at com.adobe.rtc.sharedModel::CollectionNode/getRootUserRole()[/Users/arun/Work/aponnusa_the oden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10/src/com/adobe/rtc/shar edModel/CollectionNode.as:883]
at com.adobe.rtc.sharedModel::CollectionNode/getUserRole()[/Users/arun/Work/aponnusa_theoden .corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10/src/com/adobe/rtc/sharedMo del/CollectionNode.as:471]
at com.adobe.rtc.sharedModel::CollectionNode/canUserConfigure()[/Users/arun/Work/aponnusa_th eoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10/src/com/adobe/rtc/sha redModel/CollectionNode.as:593]
at SharedMapModel/onSyncChange()[C:\Users\Compaq\Adobe Flash Builder 4\GoogleMap\src\SharedMapModel.as:185]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.adobe.rtc.sharedModel::CollectionNode/http://www.adobe.com/2006/connect/cocomo/messaging/internal::setIsSynchronized()[/Users/ar un/Work/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10/sr c/com/adobe/rtc/sharedModel/CollectionNode.as:700]
at com.adobe.rtc.messaging.manager::MessageManager/receiveAllSynchData()[/Users/arun/Work/ap onnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10/src/com/adob e/rtc/messaging/manager/MessageManager.as:851]
at com.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItems()[/Users/arun/Wo rk/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10/src/com /adobe/rtc/messaging/manager/MessageManager.as:596]
at com.adobe.rtc.session.managers::SessionManagerBase/receiveItems()[/Users/arun/Work/aponnu sa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10/src/com/adobe/rt c/session/managers/SessionManagerBase.as:456]
GoogleMap.mxml(main):
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:rtc="http://ns.adobe.com/rtc"
xmlns:maps="com.google.maps.*"
xmlns:ns2="*">
<maps:Map mapevent_mapready="onReady(event)" url="http://code.google.com/apis/maps/" id="map" width="100%" height="100%" key="ABQIAAAAa1d-LRFOUL0Fhv8VJsT-JhROcIOxpjBZUVD7XRlGFELYl3GNYxQIzt1g1Bnuf1QsKZfb47Zk7_c6 Bw" sensor="true" x="0" y="0"/>
<fx:Script>
<![CDATA[
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapMoveEvent;
import com.google.maps.MapOptions;
import com.google.maps.MapType;
import com.google.maps.MapZoomEvent;
import com.google.maps.controls.ZoomControl;
import com.google.maps.overlays.Marker;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.styles.FillStyle;
import com.google.maps.styles.StrokeStyle;
import flash.events.GeolocationEvent;
import flash.sensors.Geolocation;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import mx.events.FlexEvent;
protected var _sharedMapModel:SharedMapModel;
private var zoomControl:ZoomControl = new ZoomControl();
private function onReady(e:MapEvent):void{
this.map.visible = false;
this.map.setCenter(new LatLng(45.468799,9.188004),14, MapType.NORMAL_MAP_TYPE);
addMapControls();
setupSharedMap();
private function addMapControls():void {
map.addControl(zoomControl);
private function removeMapControls():void {
map.removeControl(zoomControl);
private function setupMapListeners():void {
map.addEventListener(MapMoveEvent.MOVE_END, onMapMoveEnd);
map.addEventListener(MapZoomEvent.ZOOM_CHANGED, onMapZoom);
private function setupSharedMap():void {
_sharedMapModel = new SharedMapModel();
_sharedMapModel.subscribe("sharedMap");
_sharedMapModel.addEventListener("subscribe",onSubscribed);
_sharedMapModel.addEventListener("latLngChange",onPositionChange);
_sharedMapModel.addEventListener("zoomChange",onZoomChange);
private function onSubscribed(p_evt:Event=null):void {
_sharedMapModel.removeEventListener("subscribe",onSubscribed);
setupMapListeners();
this.map.visible = true;
private function onMapMoveEnd(event:MapMoveEvent):void {
_sharedMapModel.latLng = this.map.getCenter();
protected function onPositionChange(p_evt:Event=null):void {
this.map.removeEventListener(MapMoveEvent.MOVE_END, onMapMoveEnd);
this.map.setCenter(_sharedMapModel.latLng);
this.map.addEventListener(MapMoveEvent.MOVE_END, onMapMoveEnd);
private function onMapZoom(event:MapZoomEvent):void {
_sharedMapModel.zoom = this.map.getZoom();
protected function onZoomChange(p_evt:Event=null):void {
this.map.removeEventListener(MapZoomEvent.ZOOM_CHANGED, onMapZoom);
this.map.setZoom(_sharedMapModel.zoom);
this.map.addEventListener(MapZoomEvent.ZOOM_CHANGED, onMapZoom);
]]>
</fx:Script>
<fx:Declarations>
<rtc:AdobeHSAuthenticator id="auth"
userName="[email protected]"
password="password"
/>
</fx:Declarations>
<rtc:ConnectSessionContainer width="100%" height="100%"
roomURL="https://collaboration.adobelivecycle.com/yytan1987/myfirstroom"
id="cSession"
authenticator="{auth}">
</rtc:ConnectSessionContainer>
</s:WindowedApplication>
SharedMapModel.as:
package
import com.adobe.rtc.events.CollectionNodeEvent;
import com.adobe.rtc.events.SharedModelEvent;
import com.adobe.rtc.messaging.MessageItem;
import com.adobe.rtc.session.ConnectSession;
import com.adobe.rtc.sharedModel.Baton;
import com.adobe.rtc.sharedModel.CollectionNode;
import com.adobe.rtc.sharedModel.SharedCollection;
import com.google.maps.LatLng;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
public class SharedMapModel extends EventDispatcher
// fired when the position of the map has been changed
[Event(name="latLngChange", type="flash.events.Event")]
// fired when the zoom level of the map has been changed
[Event(name="zoomChange", type="flash.events.Event")]
// fired when the mode of the map (annotation or navigation) has been changed
[Event(name="modeChange", type="flash.events.Event")]
// fired when the contolling user of the map has been changed
[Event(name="batonChange", type="flash.events.Event")]
[Event(name="subscribe", type="flash.events.Event")]
protected var _latLng:LatLng;
protected var _zoom:int;
protected var _mode:String;
protected var _collectionNode:CollectionNode;
protected var _myUserID:String;
protected var _controllingUser:String;
protected var _baton:Baton;
public var markerCollection:SharedCollection = new SharedCollection();
protected static const LAT_LNG_NODE:String = "latLngNode";
protected static const ZOOM_NODE:String = "zoomNode";
protected static const MODE_NODE:String = "modeNode";
public function SharedMapModel(target:IEventDispatcher=null)
super(target);
[Bindable("subscribe")]
public function subscribe(p_uniqueID:String):void
_myUserID = ConnectSession.primarySession.userManager.myUserID;
// set up the collectionNode
_collectionNode = new CollectionNode();
_collectionNode.sharedID = p_uniqueID ;
_collectionNode.subscribe();
_collectionNode.addEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE, onSyncChange);
_collectionNode.addEventListener(CollectionNodeEvent.ITEM_RECEIVE, onItemReceive);
// set up the marker collection - CocomoCollection allows you to specify an existing
// collectionNode to use for messaging, so we'll have it piggy-back on the same
// collectionNode as the one our model uses (to reduce the number of destinations on server)
markerCollection.collectionNode = _collectionNode;
// use the userID field as the unique ID for each item in the collection
markerCollection.idField = "userID";
// use one node on our collectionNode for marker details
markerCollection.subscribe();
// set up the baton. we'll also have it piggy-back on our existing collectionNode.
_baton = new Baton();
_baton.sharedID = "mapControl" ;
_baton.timeOut = 5 ;
_baton.collectionNode = _collectionNode ;
_baton.subscribe();
_baton.addEventListener(SharedModelEvent.BATON_HOLDER_CHANGE, onBatonChange);
* Sets the position of the SharedMap model. Note that the value isn't updated until the resulting
* message returns from the service.
* @param p_val - the LatLon object corresponding to the map's position
public function set latLng(p_val:LatLng):void
// baton management - if I've got the baton already, then keep it for a while longer,
// if I don't but can grab it, do so. Otherwise, I'm not allowed to update this value.
if (_baton.amIHolding) {
_baton.extendTimer();
} else if (_baton.canIGrab) {
_baton.grab();
} else {
return;
// send a message (through our collectionNode) to the service to update the position.
// note that LAT_LON_NODE is configured to only store a single item (see onSyncChange),
// so only the last item published here gets stored
var msg:MessageItem = new MessageItem(LAT_LNG_NODE, {lat:p_val.lat, lng:p_val.lng});
_collectionNode.publishItem(msg);
[Bindable("latLngChange")]
public function get latLng():LatLng
return _latLng;
* Sets the zoom level of the SharedMap model. Note that the value isn't updated until the resulting
* message returns from the service.
* @param p_val - the LatLon object corresponding to the map's position
public function set zoom(p_val:int):void
// baton management - if I've got the baton already, then keep it for a while longer,
// if I don't but can grab it, do so. Otherwise, I'm not allowed to update this value.
if (_baton.amIHolding) {
_baton.extendTimer();
} else if (_baton.canIGrab) {
_baton.grab();
} else {
return;
// send a message (through our collectionNode) to the service to update the zoom level.
// note that ZOOM_NODE is configured to only store a single item (see onSyncChange),
// so only the last item published here gets stored
var msg:MessageItem = new MessageItem(ZOOM_NODE, p_val);
_collectionNode.publishItem(msg);
[Bindable("zoomChange")]
public function get zoom():int
return _zoom;
* Sets the mode (annotation or navigation) of the SharedMap model.
* Note that the value isn't updated until the resulting
* message returns from the service.
* @param p_val
public function set mode(p_val:String):void
// baton management - if I've got the baton already, then keep it for a while longer,
// if I don't but can grab it, do so. Otherwise, I'm not allowed to update this value.
if (_baton.amIHolding) {
_baton.extendTimer();
} else if (_baton.canIGrab) {
_baton.grab();
} else {
return;
// send a message (through our collectionNode) to the service to update the mode.
// note that MODE_NODE is configured to only store a single item (see onSyncChange),
// so only the last item published here gets stored
var msg:MessageItem = new MessageItem(MODE_NODE, p_val);
_collectionNode.publishItem(msg);
[Bindable("modeChange")]
public function get mode():String
return _mode;
* returns the userID of the user currently controlling the map
[Bindable("batonChange")]
public function get controllingUser():String
return _controllingUser;
* Fired when the collectionNode has fully connected to the service and retrieved all information
* about its nodes and stored message items. Note that this is typically the time when an OWNER sets up
* the node structure of any CollectionNodes, after the CollectionNode has synched and the OWNER notices
* it hasn't got the requisite nodes.
protected function onSyncChange(p_evt:CollectionNodeEvent):void
// if I'm the OWNER and there's no node defined for LAT_LON, create one.
// note we're using the default NodeConfiguration, which only stores one item and has default
// publish/subscribe permissions.
if (!_collectionNode.isNodeDefined(LAT_LNG_NODE) && _collectionNode.canUserConfigure(_myUserID)) {
_collectionNode.createNode(LAT_LNG_NODE);
// if I'm the OWNER and there's no node defined for ZOOM, create one.
if (!_collectionNode.isNodeDefined(ZOOM_NODE) && _collectionNode.canUserConfigure(_myUserID)) {
_collectionNode.createNode(ZOOM_NODE);
// if I'm the OWNER and there's no node defined for MODE, create one.
if (!_collectionNode.isNodeDefined(MODE_NODE) && _collectionNode.canUserConfigure(_myUserID)) {
_collectionNode.createNode(MODE_NODE);
* Fired when an item is received from the service (whether from the current user's updates
* or a remote one).
protected function onItemReceive(p_evt:CollectionNodeEvent):void
if (p_evt.nodeName==LAT_LNG_NODE) {
// the latlon has been updated. Update our model value, and fire an event to notify of the change
_latLng = new LatLng(p_evt.item.body.lat, p_evt.item.body.lng);
if (p_evt.item.publisherID!=_myUserID) {
dispatchEvent(new Event("latLngChange"));
} else if (p_evt.nodeName==ZOOM_NODE) {
// the zoom has been updated. Update our model value, and fire an event to notify of the change
_zoom = p_evt.item.body;
dispatchEvent(new Event("zoomChange"));
} else if (p_evt.nodeName==MODE_NODE) {
// the mode has been updated. Update our model value, and fire an event to notify of the change
_mode = p_evt.item.body;
dispatchEvent(new Event("modeChange"));
* Fired when the holderID of the baton changes. We update our model value and fire an event to notify of the change
protected function onBatonChange(p_evt:Event):void
_controllingUser = _baton.holderID;
dispatchEvent(new Event("batonChange"));
AfcsCollection.as:
package
import mx.collections.ArrayCollection;
import com.adobe.rtc.sharedModel.CollectionNode;
import com.adobe.rtc.messaging.NodeConfiguration;
import com.adobe.rtc.events.CollectionNodeEvent;
import com.adobe.rtc.messaging.MessageItem;
import mx.core.IUID;
import com.adobe.rtc.session.ConnectSession;
[Event(name="synchronizationChange", type="com.adobe.rtc.events.CollectionNodeEvent")]
public class AfcsCollection extends ArrayCollection
public function AfcsCollection(source:Array=null)
super(source);
public var collectionNode:CollectionNode;
protected static const ITEM_NODE:String = "itemNode";
protected var _nodeConfig:NodeConfiguration;
protected var _nodeName:String = ITEM_NODE;
protected var _myUserID:String;
* what field in each item can be used as a unique identifier?
public var idField:String;
* what class is each item?
public var itemClass:Class;
[Bindable("synchronizationChange")]
public function get isSynchronized():Boolean
if (collectionNode) {
return collectionNode.isSynchronized;
} else {
return false;
public function subscribe(p_uniqueID:String, p_nodeConfig:NodeConfiguration=null):void
_nodeConfig = (p_nodeConfig) ? p_nodeConfig : new NodeConfiguration();
_nodeConfig.itemStorageScheme = NodeConfiguration.STORAGE_SCHEME_MANUAL;
_myUserID = ConnectSession.primarySession.userManager.myUserID;
if (collectionNode==null) {
collectionNode = new CollectionNode();
collectionNode.sharedID = p_uniqueID ;
collectionNode.subscribe();
} else {
_nodeName = p_uniqueID;
collectionNode.addEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE, onSyncChange);
collectionNode.addEventListener(CollectionNodeEvent.ITEM_RECEIVE, onItemReceive);
collectionNode.addEventListener(CollectionNodeEvent.ITEM_RETRACT, onItemRetract);
override public function setItemAt(p_item:Object, p_index:int):Object
var oldItem:Object = getItemAt(p_index);
var msg:MessageItem = new MessageItem(_nodeName, p_item, getItemID(oldItem));
collectionNode.publishItem(msg, true);
return oldItem;
override public function addItem(p_item:Object):void
var msg:MessageItem = new MessageItem(_nodeName, p_item, getItemID(p_item));
collectionNode.publishItem(msg);
override public function removeItemAt(p_index:int):Object
var oldItem:Object = getItemAt(p_index);
collectionNode.retractItem(_nodeName, getItemID(oldItem));
return oldItem;
override public function removeAll():void
var l:int = length;
for (var i:int=l-1; i>=0; i--) {
removeItemAt(i);
protected function onSyncChange(p_evt:CollectionNodeEvent):void
if (!collectionNode.isNodeDefined(_nodeName) && collectionNode.canUserConfigure(_myUserID, _nodeName)) {
// this collectionNode has never been built, and I can add it...
collectionNode.createNode(_nodeName, _nodeConfig);
dispatchEvent(p_evt);
protected function onItemReceive(p_evt:CollectionNodeEvent):void
if (p_evt.nodeName!=_nodeName) {
return;
var newItem:Object = p_evt.item.body;
var itemID:String = (idField) ? newItem[idField] : newItem.uid;
var oldItem:Object;
var i:String;
// yes, this is ugly. Improve later
var l:int = length;
for (var idx:int=0; idx<l; idx++) {
if (itemID==getItemID(getItemAt(idx))) {
oldItem = getItemAt(idx);
break;
if (oldItem) {
// it's an item update
for (i in newItem) {
if (newItem[i]!=oldItem[i]) {
var tmpOldValue:Object = oldItem[i];
oldItem[i] = newItem[i];
itemUpdated(oldItem, i, tmpOldValue, oldItem[i]);
super.setItemAt(oldItem, idx);
} else {
// it's a brand new item
if (itemClass) {
// yeah, this wouldn't work if there are constructor args
var newItemTyped:Object = new itemClass();
for (i in newItem) {
newItemTyped[i] = newItem[i];
super.addItem(newItemTyped);
} else {
super.addItem(newItem);
protected function onItemRetract(p_evt:CollectionNodeEvent):void
if (p_evt.nodeName!=_nodeName) {
return;
var newItem:Object = p_evt.item.body;
var itemID:String = (idField) ? newItem[idField] : newItem.uid;
var oldItem:Object;
// yes, this is ugly. Improve later
var l:int = length;
for (var idx:int=0; idx<l; idx++) {
if (itemID==getItemID(getItemAt(idx))) {
oldItem = getItemAt(idx);
break;
if (oldItem) {
super.removeItemAt(idx);
protected function getItemID(p_item:Object):String
return (p_item is IUID) ? IUID(p_item).uid : p_item[idField] as String;
Maybe you are looking for
-
My old computer crashed. How do I get my itunes onto my new HP comuter with windows 8?
How do I get my iTunes library onto my new computer if my old computer is fried?
-
Hi, I recently got a update on my phone. I installed it inmy Lumia 625 but unfortunately its not working nor its showing Lumia BLACk in extras+info!! It is constantly showing to use a wifi connection which i dont have..pls help!!
-
Dr Brown's 1-2-3 not changing resolution
Whenever I use Dr Brown's 1-2-3 script for resizing images they always resize to 72ppi instead of what I put in. Any ideas why this should be. I am trying to resize from 300ppi to 240 ppi.
-
Loading BBC Iplayer into Mountain Lion..?
- I used to have BBC iplayer on my Imac when I was using snow leopard but when I recently upgraded to Mountain Lion Ii found that I am unable to re-install BBC iPlayer. I use firefox and google and the only way around this problem was to go through
-
Email kan niet in de prullenbak
Bij de ipad 1 geen problemen met de instelling, mail gaat gewoon in de prullenbak. Bij Ipad 2 krijg ik de melding bericht kan niet worden verplaatst. Opnieuw account al aangemaakt en opnieuw opgestart, maar er gebeurt niets.