...
Code Block |
---|
|
<fx:Style>
mx|Text
{
font-family: infiniteNonCFFFont;
}
</fx:Style> |
Widget Saving - Community vs User OptionsTypically a widget will save any options that it wants on reloading during a onSaveWidgetOptions call. Any json object passed to the widget framework on that call will be returned when the widget is loaded via onLoadWidgetOptions in a WidgetSaveObject. The WidgetSaveObject has 2 interesting fields, userSave and communitySave. The userSave object is the standard object that was saved during a onSaveWidgetOptions call and should be used for any save options that are unique to an individual user; for example their current zoom level and centerpoint on map widget or the graph type on a statistics widget.
...
Code Block |
---|
title | Loading 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]);
}
}
}
}
} |
Anchor |
---|
| widgetdragdrop |
---|
| widgetdragdrop |
---|
|
Widget Drag and DropA generic drag and drop interface is implemented for sending document, entities, and associations between widgets. To accept these things a widget only needs to implement an event handler for the widgetDrop event on WidgetModule
...