Select to view content in your preferred language

How to dont open a new window with URL Request

3228
2
Jump to solution
05-12-2015 07:58 AM
EvelynHernandez
Frequent Contributor

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

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Evelyn,

   The way it is suppose to work is if you name the new window that you open then you can reuse that same window.

navigateToURL(request, "mycustomwindowname");

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Evelyn,

   The way it is suppose to work is if you name the new window that you open then you can reuse that same window.

navigateToURL(request, "mycustomwindowname");

0 Kudos
EvelynHernandez
Frequent Contributor

Oh, that was easy,

Thank u so much Robert

0 Kudos