|
POST
|
Hello, Im trying to delevop a widget in Flex as the StreetView widget. I need to open a website clicking in a widget button in flex and pass some parameters in the website url to show a picture. I have this code but everytime when i click in the button the website window is opened again with the parameters that i want, so how can i pass different values everytime when the button is pressed and dont open the website window again? (idk if theres a way to refresh the same window and change the url parameters). Here is my code, any example that u can have will be useful for me. The widget (FIXED): <?xml version="1.0" encoding="utf-8"?>
<viewer:BaseWidget 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:viewer="com.esri.viewer.*"
xmlns:util="widgets.StreetView.util.*"
x="600" y="300">
<fx:Script>
<![CDATA[
import flash.net.navigateToURL;
import mx.controls.Alert;
public var nFoto:String;
public var nSSEE:String;
protected function abrirVentanaExterna_clickHandler(event:MouseEvent):void
{
nFoto=txtNumFoto.text;
nSSEE= txtNombreSSEE.text;
var url:String = "widgets/InterfazExterna/GISRED360/index.html";
var variables:URLVariables = new URLVariables();
variables.numeroFoto = nFoto;
variables.nombreSSEE = nSSEE;
var request:URLRequest = new URLRequest(url);
request.data = variables;
try {
navigateToURL(request, url);
}
catch (e:Error) {
// handle error here
Alert.show(e.toString());
}
}
]]>
</fx:Script>
<fx:Declarations>
</fx:Declarations>
<viewer:WidgetTemplate id="wTemplate">
<mx:VBox>
<s:Label text="Indique nombre SSEE:">
</s:Label>
<mx:TextInput id="txtNombreSSEE" text="PLACILLA"/>
<s:Label text="Indique numero de Foto:">
</s:Label>
<mx:TextInput id="txtNumFoto" text="1"/>
<s:Button id="abrirVentanaExterna" label="Open HTML"
click="abrirVentanaExterna_clickHandler(event)" />
</mx:VBox>
</viewer:WidgetTemplate>
</viewer:BaseWidget> The directory in the Widget Package: See attachment file. I have the Website in the package. Thanks for ur help! Mensaje editado por: Evelyn Hernandez
... View more
05-12-2015
07:58 AM
|
0
|
2
|
3764
|
|
POST
|
Steve, I have this as example, i hope this work for u too: var trans = new InfoTemplate();
trans.setTitle("<b>ID: ${concesion_id}</b>");
var transInfoContent =
"<div style=padding-top: 10px;>Class: ${class}<br></div>" +
"<div style=display:inline-block;width:8px;></div>";
trans.setContent(transInfoContent);
//ADD Templates to MapServer
chqMapServer.setInfoTemplates({
0:{ infoTemplate: trans}
});
//adding the layer to the map
map.addLayer(chqMapServer); Verify the attributes in ${} have the same name how they were specified in ur rest srv.
... View more
05-12-2015
05:56 AM
|
0
|
0
|
2424
|
|
POST
|
Yes thanks Nigel as always. I already resolve my problem using ur suggestion long ago
... View more
05-12-2015
05:23 AM
|
1
|
1
|
1624
|
|
POST
|
I see. The thing is now how to use a proxy... . Is there any example about how to use one ? Im trying to find any guidance but no results
... View more
05-11-2015
06:03 AM
|
0
|
1
|
1362
|
|
POST
|
Well i did with a code example using esri leaflet, but the thing is how can i integrate both codes. The other one that i showed before and this one: <script>
var map = new L.Map('map').setView([34.326, -117.697], 12);
var map;
var dominio = "mydomain";
var sl = new String('\\');
var usuario = "myuser";
var userid = dominio + sl + usuario;
L.esri.basemapLayer('Topographic').addTo(map);
function serverAuth(callback){
L.esri.post('.../arcgis/tokens/generateToken', {
username: userid,
password: 'mypass',
f: 'json',
expiration: 86400,
client: 'referer',
referer: window.location.origin
}, callback);
}
serverAuth(function(error, response){
var dl = L.esri.dynamicMapLayer(...'arcgis/rest/services/MapaBase/MapServer', {
opacity: 1,
token: response.token
}).addTo(map);
dl.on('authenticationrequired', function (e) {
serverAuth(function(error, response){
e.authenticate(response.token);
});
});
});
</script>
... View more
05-11-2015
05:22 AM
|
0
|
3
|
1362
|
|
POST
|
Hello, Im trying to find some code to add to my app for logging in with tokens using a userid and pass for default but i dont know how to do it. How can i do that using my code? I have the following: var map;
var dominio = "vialactea";
var sl = new String('\\');
var usuario = "ehernanr";
var userid = dominio + sl + usuario;
var pass = 'chilquinta5';
require([
"dojo/dom-construct",
"esri/Color",
"esri/dijit/Geocoder",
"esri/dijit/Popup",
"esri/InfoTemplate",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/map",
"esri/symbols/SimpleFillSymbol",
"esri/symbols/SimpleLineSymbol", "dojo/domReady!",
"esri/IdentityManager",
"esri/ServerInfo",
"esri/Credential",
"esri/request"
], function(
domConstruct, Color, Geocoder, Popup, InfoTemplate,
ArcGISDynamicMapServiceLayer, Map, SimpleFillSymbol, SimpleLineSymbol, idManager, ServerInfo, Credential, esriRequest
) {
var sls = new SimpleLineSymbol("solid", new Color("#444444"), 3);
var sfs = new SimpleFillSymbol("solid", sls, new Color([68, 68, 68, 0.25]));
var popup = new Popup({
fillSymbol: sfs,
lineSymbol: null,
markerSymbol: null
}, domConstruct.create("div"));
map = new Map("map", {
basemap: "topo",
center: [-71.0659,-32.9252], // long, lat
zoom: 8,
sliderStyle: "small",
infoWindow: popup
});
//AÑADIR MAPSERVER
var chqMapServer = new ArcGISDynamicMapServiceLayer(".../PMS/Concesiones/MapServer", {
"id": "concesiones",
"opacity": 0.75
});
//TEMPLATE PARA MOSTRAR INFOWINDOW SSEE (0)
var trans = new InfoTemplate();
trans.setTitle("<b>ID: ${concesion_id}</b>");
var transInfoContent =
"<div style=padding-top: 10px;>Clase: ${clase}<br></div>" +
"<div style=display:inline-block;width:8px;></div>";
trans.setContent(transInfoContent);
//TEMPLATE PARA MOSTRAR INFOWINDOW SSEE (1)
var dist = new InfoTemplate();
dist.setTitle("<b>ID: ${concesion_id}</b>");
var distInfoContent =
"<div style=padding-top: 10px;>Clase: ${clase}<br></div>" +
"<div style=display:inline-block;width:8px;></div>";
dist.setContent(distInfoContent);
//Añadiendo Templates al MapServer
chqMapServer.setInfoTemplates({
0:{ infoTemplate: trans},
1:{ infoTemplate: dist }
});
//Agregando la capa al mapa
map.addLayer(chqMapServer);
var chqMapServer2 = new ArcGISDynamicMapServiceLayer("...PMS/Electricidad/MapServer", {
"id": "electricidad",
"opacity": 0.75
});
//TEMPLATE PARA MOSTRAR INFOWINDOW SSEE (1)
var dist = new InfoTemplate();
dist.setTitle("<b>ID: ${id_tramo}</b>");
var distInfoContent =
"<div style=padding-top: 10px;>Sed: ${sed}<br></div>" +
"<div style=display:inline-block;width:8px;></div>";
dist.setContent(distInfoContent);
//Añadiendo Templates al MapServer
chqMapServer2.setInfoTemplates({
2:{ infoTemplate: dist}
});
map.addLayer(chqMapServer2);
}); Thanks for all ur help as always !
... View more
05-09-2015
11:47 AM
|
0
|
5
|
5485
|
|
POST
|
Yes ur example works perfectly. the error was in the onresult maybe and the addatch sentence. I have another question. If u want to do a delete or update on one especified attch how will it be the featurelayer.addattachment sentence for both cases? Or i have to use another method to do that? Thanks
... View more
05-07-2015
10:08 AM
|
0
|
17
|
2230
|
|
POST
|
Thanks a lot! i already tried it with my rest srv and it works perfectly U rock !
... View more
05-07-2015
09:49 AM
|
0
|
19
|
2230
|
|
POST
|
In fact, i usually do some debug on the apps with Alert.show(); but in this case my point is, the addAttachment method doesnt make anything. Its like the code goes to the line before the addAttch and when go to the addatch line the function doesnt do anything. Its weird cuz atleast if the adding fails has to go to the fault result, or if its successful, go to the onresult function, but even with those controls doesnt do anything. About the debug.exe i installed the one u just link me. But i always get the same error. Its strange. Thanks i will be waiting for ur working example for this. I really appreciate all ur answers
... View more
05-06-2015
10:47 AM
|
0
|
23
|
2230
|
|
POST
|
No. I installed it and fb still doesnt recognize me the debugger. It tries to make the connection and got an error with the following msg: "Flash builder cannot locate the requited debugger version of adobe flash player....." I put that i want to try the debug with the current version and it tries to load the app but nothing happens. So, i think if anyone can provide me any working example using attachment for PFD and any file will be better,,, (W/o using the attachment inspector) Thanks for all ur help as always.
... View more
05-06-2015
05:32 AM
|
0
|
25
|
2230
|
|
POST
|
The code that u send me doesnt do anything, but in my rest srv i have the has attachment in true. Im downloading the debugger. And i also tried putting the "PDF" in the content type but still doesnt work. Idk what more i should do...
... View more
05-05-2015
11:25 AM
|
0
|
27
|
2970
|
|
POST
|
i cannot debug my app, so when i execute the code i dont get any responde (not true or false)
... View more
05-05-2015
05:18 AM
|
0
|
29
|
2970
|
|
POST
|
I need some help, im stuck on this. I have to save a pdf file or image file in the arcgis db and idk how to do it through a widget. Theres no code example to try and seems nobody has done yet. I have been trying with the attch inspector but it doesnt work. Anyone can give any example ? Thanks for ur help. I have this code but it doesnt work. public function savePDF(byteArr:ByteArray):void
{
var myfeaturelayer:FeatureLayer = new FeatureLayer;
myfeaturelayer.url = "http:...../PMGD/FeatureServer/8";
myfeaturelayer.id = "NewEtaFeature";
myfeaturelayer.addAttachment(1,byteArr,"ElementoPDF", null,new AsyncResponder(resultado,malresultado));
function resultado(event:AttachmentEvent):void{
Alert.show("saved");
}
function malresultado(fault:FaultEvent):void{
Alert.show("not saved");
}
}
... View more
05-04-2015
11:34 AM
|
0
|
31
|
2970
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-21-2017 02:09 PM | |
| 1 | 04-10-2015 07:52 AM | |
| 1 | 03-23-2016 02:08 PM | |
| 1 | 02-22-2016 05:01 AM | |
| 1 | 10-09-2018 07:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-01-2024
03:05 AM
|