Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleLoading Community Save Data
public function onLoadWidgetOptions( widgetOptions:WidgetSaveObject ):void
{               
    if ( widgetOptions != null )
    {
        //this holds a users last map 
        if ( widgetOptions.userSave != null )
        {
              //...code from above here
        }
		if ( widgetOptions.communitySave != null )
		{
			//Any shares you have access to with type widgetSave will be provided here
			//Here we will be given a map of community ids to shares e.g. { "commid12345": {"key1":"value1"}, "commid67890":{"anotherkey",["blue","green","red"]}}
			for ( var commid:String in widgetOptions.communitySave )
			{
				//this is the object saved in the share for community <commid>
				//Now you can do what you want with it (we printed it out)
				var community_save_object = widgetOptions.communitySave[commid];
				for ( var key:String in community_save_object )
				{					
					trace("CommId: " + commid + " key: " + key + " value: " + community_save_object[key]);
					
				}
			}
		}
 	}
}

The map widget that ships with the platform shows an example of using the per-community settings in order to allow different KML layers. To use, upload each KML as a binary share (not necessary if the KML is accessible via URI) and then upload a JSON share with type "widgetsave" that looks like:

Code Block
{
	"kml-name1": "URI1",
	"kml-name2": "URI2",
	//etc
}

(NOTE: must be shared to a non-personal community)

All members of the communities to which the file is shared (and the uploaded KML, if any) should then see the KML names in the "KML Layers" dropdown.

Anchor
widgetdragdrop
widgetdragdrop
Widget Drag and Drop

...