POST
|
Shannaka, I guess normally you could use the fetchSharedData() in the init function, I use it a bit later because I call a few other functions in my init functions that creates some components and set there values based on info in the config file. But the important thing is that you've added the eventlistenter ( ViewerContainer.addEventListener(AppEvent.DATA_SENT, sharedDataUpdated); ) before you call fetchSharedData(), it's used just to trigger that event.
... View more
03-20-2011
11:47 PM
|
0
|
0
|
735
|
POST
|
Thanks for all your help Robert! After I added the call to fetchSharedData() in widget2 it works great.
... View more
03-17-2011
01:12 AM
|
1
|
0
|
735
|
POST
|
Robert, I added the event listener to the init of widget2 and the function to that event listener. But still it doesn't work, the function never runs. My knowledge about AppEvents are limited, but I'm thinking that the event listener is added after the event is dispatched and therefor nothing happens. But if this code work for you, I guess it should work for me to, but it doesn't... What's the difference between AppEvent.DATA_PUBLISH and AppEvent.DATA_SENT? The data that is added from addSharedData in widget1 has to be stored somewhere, is there no way to access it from widget2 without any event listeners??
... View more
03-16-2011
12:28 AM
|
0
|
0
|
735
|
POST
|
Robert, No I still can't achieve all I want. If I Have my two widgets open then there is no problem for widget1 to send data to widget2 that uses the data to perform a findtask. But If widgets2 is not loaded it loads but don't perform any findtask. I want it to load and receive the data and perform the findtask. If widget2 is loaded once and then closed so the state of the widget is closed it works fine, but the problem is when the widget never have been opened/loaded during the session. I've tried to use some fetchSharedData() code at the creationComplete event for widget2 to see if there is any data with my key in shareddata, but I can't fetch any data, don't know how to use the fetchSharedData. (I saw another thread about a bug in Datamanager.as, made that change but it didn't changed anything for me).
... View more
03-15-2011
05:28 AM
|
0
|
0
|
735
|
POST
|
Thanks Robert! That was it, I didn't see that part in any code in previous posts.
... View more
03-11-2011
05:15 AM
|
0
|
0
|
418
|
POST
|
Hi! This thread helped me to communicate between widgets, I'm sending a graphic from one widget to another which use the graphic as input to an identifyTask. This works fine as long as both widgets are opened. If the user haven't opened the second widget yet I want to open that widget and send the graphic. I can open the widget (but I have to hardcode the widget id, the getWidgetId function doesn't work for me, but that's another question I asked in another thread). But if the widget is just opened it obviously didn't had time to add the eventlister and litsen to the AppEvent.DATA_PUBLISH, so nothing happens, the user has to do the same request again. Any ideas how to accomplish to open a widget and sending data to it at the same time (or at least without any user input after the widget is loaded??
... View more
03-11-2011
05:09 AM
|
0
|
0
|
735
|
POST
|
Hi, I'm trying to use this code to open a widget from another, I've added the code to my ViewerContainer, but when I'm trying to access the ViewerContainer.getWidgetId function from another widget I get an error. 1061: Call to a possibly undefined method getWidgetId through a reference with static type Class. What could I be doing wrong here, it is a public function and I have an import for com.esri.viewer.ViewerContainer in my widget but still I can't get to that function.
... View more
03-10-2011
11:35 PM
|
0
|
0
|
418
|
POST
|
I haven't done this, but I do save visible layers when user close the appliaction and load them when the user opens it again. The code I use for saving och loading visible layers might help you. Saving visible layers to SharedObjects: settingsSO = SharedObject.getLocal("HlsbgSettings");
var map:Map = ViewerContainer.getInstance().mapManager.map
acVisLayers = new ArrayCollection();
MapUtil.forEachMapLayer(map, function(layer:Layer):void {
var layVisAc:ArrayCollection;
if (layer is ArcGISDynamicMapServiceLayer) {
layVisAc = ArcGISDynamicMapServiceLayer(layer).visibleLayers;
} else if (layer is ArcIMSMapServiceLayer) {
layVisAc = ArcIMSMapServiceLayer(layer).visibleLayers;
} else if (layer is ArcGISTiledMapServiceLayer) {
layVisAc = ArcGISTiledMapServiceLayer(layer).visibleLayers;
}
var lvisObj:Object = {
name: layer.name,
visible: layer.visible,
visarray: layVisAc
}
acVisLayers.addItem(lvisObj);
});
settingsSO.data[VISLAYERS] = acVisLayers;
settingsSO.flush();
visible layers from SharedObjects: settingsSO = SharedObject.getLocal("HlsbgSettings");
if (settingsSO.size > 0) {
var acVisLayers:ArrayCollection = settingsSO.data.vislayers as ArrayCollection;
if (acVisLayers.length > 0){
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;
}
}
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;
}
});
}
}
} (The code is actually from something Robert Scheitlin wrote for SFV 1.3 that I've modified just a little bit to work in my SFV 2.1)
... View more
02-22-2011
10:16 PM
|
0
|
0
|
283
|
POST
|
Thanks for this! I already have a copy XY contextmenu, and a tool for GoTo XY, and don't really need the projecting. But still this one is very useful because now I can use this widget with a few modifications instead of adding a lot of code in the main application like mapmanager and other files which i try to avoid as much as possible. Great work! thanks again.
... View more
02-18-2011
02:46 AM
|
0
|
0
|
1874
|
POST
|
If you're using och spatial reference where the distance is equal to sqrt((x1-x2)^2 + (y1-y2)), you could use that and some mouseEvents (like MouseEvent.MOUSE_MOVE and MapMouseEvent.MAP_CLICK) and event.stageX, event.stageY along with toMapFromStage.
... View more
02-17-2011
06:56 AM
|
0
|
0
|
154
|
POST
|
Maybe this sample is what you're looking for? http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=NavigationTools
... View more
02-17-2011
06:38 AM
|
0
|
0
|
188
|
POST
|
The idea has crossed my mind, I think that would be great enhancement to the splash screen. I guess on of the problem is that if you don't want it to show, you don't want the widget to load at all, which probably means that you can't add all the code to the widget it self.
... View more
01-25-2011
08:49 PM
|
0
|
0
|
556
|
POST
|
I have a question about the saving part. When the dialog for saving the file opens the user can either just accept to default file name with the extension .txt and everything is fine. But I'm guess many users want to change the name and probably won't add the extension because they're expecting the correct extension to be added anyway. But it doesn't cause you're not saving the file as a specific file type, and then you wont be able to open it when the file filter does exists in the opening dialog. I googled this and I didn't find anything official from Adobe, but in some forums people are saying that it is impossible to specify file type when saving because it could be a security risk (to save exe-files for example). Is there anyone who has looked into to this and found some solution or do I just have to accept that this is how it works?? It's exactly the same thing in the PDFWidget when saving the pdf file. It annoys me.
... View more
01-21-2011
05:03 AM
|
0
|
0
|
512
|
POST
|
I've only tested on one other computer that had the problems, but the default viewer seems to work. I also tested to compile the sourcecode of the 2.1 Viewer that my application is based on and that also worked. So I guess I must have screwed up the code somewhere. It's difficult to find out where when everything works fine on my computer (and some others).
... View more
01-18-2011
10:03 PM
|
0
|
0
|
478
|
POST
|
I haven't really solved the problem yet, and now I'm having really weird problems which I don't know if they're related to the problems above. However, we released our customized FlexViewer in our organisation yesterday, and for some reason it just doesn't work on some computers. The weird thing is that on a few computers an older version works but not the new one (just made some small changes and added a couple of more widgets between those versions). And that the new version might actually work if you open it twice. I tested this on two different computers that had problems, opening the link to my application i get a blank window (we're using firefox 3.6) the status bar shows "reading fpdownload.adobe.com" but nothing happens. (My messages is in swedish so I'm not sure if it actually says "reading" or if something similar). But if I leave that firefox-window as it is and open a new one, then the application works in the new window, and I can go to the first one and refresh and it will work. After closing all windows i have to do the same thing again. I really can't understand what is causing this, is there anyone who do? I guess it isn't a FlexViewer och ArcGIS API for flex problem so maybe I should be asking somewhere else, does anyone has some tips on where to turn? could it be a flex issue or a flashplayer issue or something else?
... View more
01-18-2011
04:49 AM
|
0
|
0
|
478
|
Title | Kudos | Posted |
---|---|---|
1 | 10-14-2015 01:59 AM | |
2 | 06-13-2024 12:31 AM | |
2 | 03-28-2024 01:07 AM | |
1 | 03-27-2024 04:09 AM | |
1 | 06-13-2024 12:22 AM |
Online Status |
Offline
|
Date Last Visited |
yesterday
|