<!-- saved from url=(0014)about:internet --> <html lang="en"> <!-- Smart developers always View Source. This application was built using Adobe Flex, an open source framework for building rich Internet applications that get delivered via the Flash Player or to desktops via Adobe AIR. Learn more about Flex at http://flex.org // --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>${title}</title> <script src="AC_OETags.js" language="javascript"></script> <style> body { margin: 0px; overflow:hidden } </style> </head> <body scroll='no'> <script language="JavaScript" type="text/javascript"> <!-- AC_FL_RunContent( "src", "${swf}", "width", "${width}", "height", "${height}", "align", "middle", "id", "${application}", "quality", "high", "bgcolor", "${bgcolor}", "name", "${application}", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", "pluginspage", "http://www.adobe.com/go/getflashplayer" ); // --> </script> <script language="JavaScript" type="text/javascript"> window.onbeforeunload = clean_up; function clean_up() { var flex = document.${application} || window.${application}; flex.savesettings(); } </script> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="${application}" width="${width}" height="${height}" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> <param name="movie" value="${swf}.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="${bgcolor}" /> <param name="allowScriptAccess" value="sameDomain" /> <embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}" width="${width}" height="${height}" name="${application}" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"> </embed> </object> </noscript> </body> </html>
Daniel,
I tested this again and low and behold it was not working, so I dug in and guess there is some syntax errors in the JavaScript portion so try replacing your index.template.html with this:<!-- saved from url=(0014)about:internet --> <html lang="en"> <!-- Smart developers always View Source. This application was built using Adobe Flex, an open source framework for building rich Internet applications that get delivered via the Flash Player or to desktops via Adobe AIR. Learn more about Flex at http://flex.org // --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>${title}</title> <script src="AC_OETags.js" language="javascript"></script> <style> body { margin: 0px; overflow:hidden } </style> </head> <body scroll='no'> <script language="JavaScript" type="text/javascript"> <!-- AC_FL_RunContent( "src", "${swf}", "width", "${width}", "height", "${height}", "align", "middle", "id", "${application}", "quality", "high", "bgcolor", "${bgcolor}", "name", "${application}", "allowScriptAccess","sameDomain", "type", "application/x-shockwave-flash", "pluginspage", "http://www.adobe.com/go/getflashplayer" ); // --> </script> <script language="JavaScript" type="text/javascript"> window.onbeforeunload = clean_up; function clean_up() { var flex = document.${application} || window.${application}; flex.savesettings(); } </script> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="${application}" width="${width}" height="${height}" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> <param name="movie" value="${swf}.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="${bgcolor}" /> <param name="allowScriptAccess" value="sameDomain" /> <embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}" width="${width}" height="${height}" name="${application}" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"> </embed> </object> </noscript> </body> </html>
//This is code for MapManager.mxml //config private function config(event:AppEvent):void { configData = event.data as ConfigData; map = new Map(); map.id = "map"; map.zoomSliderVisible = false; map.addEventListener(MapEvent.LOAD, mapLoadComplete); this.addChild(map); SiteContainer.dispatchEvent(new AppEvent(AppEvent.MAP_LOADED, false, false, map)); var infoContainer:Canvas = new Canvas(); infoContainer.percentWidth = 100; infoContainer.percentHeight = 100; infoContainer.horizontalScrollPolicy = "off"; infoContainer.verticalScrollPolicy = "off"; this.addChild(infoContainer); infoPopup = new InfoPopup(); infoPopup.map = map; infoContainer.addChild(infoPopup); navToolbar = new Navigation(); navToolbar.map = map; drawToolbar = new Draw(); drawToolbar.map = map; drawToolbar.addEventListener(DrawEvent.DRAW_END, onDrawEnd); getDefaultStatus(); var i:int = 0; for (i = 0; i < configData.configExtents.length; i++) { var id:String = configData.configExtents.id; var ext:String = configData.configExtents.extent; var extArray:Array = ext.split(" "); var extent:Extent = new Extent(Number(extArray[0]), Number(extArray[1]), Number(extArray[2]), Number(extArray[3])); if (id == "full") { fullExtent = extent; } if (id == "initial") { map.extent = extent; } } for (i = 0; i < configData.configMap.length; i++) { var label:String = configData.configMap.label; var type:String = configData.configMap.type; var url:String = configData.configMap.url; var visible:Boolean = configData.configMap.visible; var alpha:Number = Number(configData.configMap.alpha); var style:String = configData.configMap.style; switch (type.toLowerCase()) { case "tiled": { var tiledlayer:ArcGISTiledMapServiceLayer = new ArcGISTiledMapServiceLayer(url); tiledlayer.id = label; tiledlayer.name = label; tiledlayer.visible = visible; tiledlayer.alpha = alpha; map.addLayer(tiledlayer); break; } case "dynamic": { var dynlayer:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(url); dynlayer.id = label; dynlayer.name = label; dynlayer.proxyURL = configData.proxy; dynlayer.visible = visible; dynlayer.alpha = alpha; map.addLayer(dynlayer); break; } case "virtualearth": { var veTiledLayer:VETiledLayer = new VETiledLayer(); veTiledLayer.id = label; veTiledLayer.tokenURL = url; veTiledLayer.environment = "production"; veTiledLayer.visible = visible; veTiledLayer.alpha = alpha; veTiledLayer.mapStyle = style; veTiledLayer.name = label; map.addLayer(veTiledLayer); break; } } } map.panArrowsVisible = false; map.zoomSliderVisible = true; map.logoVisible = true; Alert.show("Do you want to load your last session state? This will restore the maps extent " + "and the visiblity of the layers that were set in your last session." + "Do you want to load your previous session settings?", "Question", Alert.YES|Alert.NO, null, alertClickHandler, expClass, Alert.YES); } private function alertClickHandler(event:CloseEvent):void { if (event.detail==Alert.YES) { //This is where we are loading the state from the saved object settingsSO = SharedObject.getLocal("MYSFV13SAVEDSETTINGS"); if (settingsSO.size > 0) { callLater(setExt,[settingsSO.data.extent]); function setExt(obj:Object):void { var mext:Extent = new Extent(obj.xmin, obj.ymin, obj.xmax,obj.ymax,map.spatialReference); map.extent = mext; } var acVisLayers:ArrayCollection = settingsSO.data.vislayers as ArrayCollection; MapUtil.forEachMapLayer(map, function(layer:Layer):void { var cLayId:int = 0; for(var i:Number=0; i<acVisLayers.length -1;i++) { if(acVisLayers.name == layer.name) { cLayId = i; break; } } var layVisAc:ArrayCollection; if (layer is ArcGISDynamicMapServiceLayer) { layer.visible = acVisLayers[cLayId].visible; ArcGISDynamicMapServiceLayer(layer).visibleLayers = acVisLayers[cLayId].visarray; } else if (layer is ArcIMSMapServiceLayer) { layer.visible = acVisLayers[cLayId].visible; ArcIMSMapServiceLayer(layer).visibleLayers = acVisLayers[cLayId].visarray; } else if (layer is ArcGISTiledMapServiceLayer) { layer.visible = acVisLayers[cLayId].visible; } }); } }
var wgt:IBaseWidget = ViewerContainer.getInstance().widgetManager.getWidget(Number(acWidgets.id),false); wgt.setState(wgtObj.state); if(wgt.getState() != WidgetStates.WIDGET_MINIMIZED) { wgt.initialWidth = wgtObj.width; wgt.initialHeight = wgtObj.height; } wgt.setXYPosition(Number(acWidgets.x),Number(acWidgets.y)); wgt.setPreload(wgt.getState());How can other widgets be accessed into an IBaseWidget object? I have tried several things such as retrieving from ModuleInfo -
wgt = moduleInfo.factory.create() as IBaseWidget;I haven't found anything that works. Thanks for any insight!