Archive for the ‘navigateToURL’ Category

Calling JavaScript function using navigateToURL

November 15th, 2011 by aabhaanjan

JavaScript and NavigateToURL

In this example we are going to explain
1. How to call a javaScript function.
2. How to pass parameters.
[xml]

xmlns:mx=”library://ns.adobe.com/flex/mx”
xmlns:s=”library://ns.adobe.com/flex/spark”>
click=”callJavaScript(event)”/>

[/xml]

Tags: , , , ,

navigateToURLExample

November 15th, 2011 by aabhaanjan
In this example we will see following points :
1. Sending variable in a form of String using navigateToURL.
2. Opening options for new window

Google Search with navigateToURL

In this example we will see following points :

1. Sending variable in a form of String using navigateToURL.

2. Opening options for new window.

In this example we will open a Google search window using  _self or _blank window. There are other _parent window option is

also which we will see in our other example :

[xml]

<?xml version=”1.0″ encoding=”utf-8″?>

<s:Application

xmlns:fx=”http://ns.adobe.com/mxml/2009″

xmlns:mx=”library://ns.adobe.com/flex/mx”

xmlns:s=”library://ns.adobe.com/flex/spark”>

<fx:Script>

<![CDATA[

import flash.net.*;

import mx.controls.Alert;

import mx.events.CloseEvent;

public function checkWindowOpenMode(event:MouseEvent):void {

Alert.show(“Open new tab to search in Google Maps or self ?”, “”, Alert.YES |Alert.NO, null, alertListener, null, Alert.NO);

}

private function alertListener(eventObj:CloseEvent):void {

var url:String = “http://maps.google.com.au/maps?q=” + search_input.text;

var urlReq:URLRequest = new URLRequest(url);

if (eventObj.detail==Alert.YES){

navigateToURL(urlReq, “_blank”);

}

else if (eventObj.detail==Alert.NO){

navigateToURL(urlReq, “_self”);

}

}

]]>

</fx:Script>

<s:Button x=”325″ y=”170″ width=”94″ height=”35″ label=”Search”

click=”checkWindowOpenMode(event)”/>

<s:TextArea id=”search_input” x=”232″ y=”120″ width=”294″ height=”37″/>

<s:Label x=”225″ y=”78″ color=”#700505″ fontSize=”16″ fontWeight=”bold”

text=”Type your search here for Google map “/>

</s:Application>

[/xml]

Tags: , , , , , ,