In flex we use navigateToUrl () method to traverse to a WEB page, usually with a link Button or Button.
So how to do this with Javascript code behind the flex App, the solution is simple with a line a code.
The line is :
window.location.href=”";
specify the link in the double quotes.
Example:
In flex iam having Button which calls the function redirect() at JS,which contains the line of code, then definition would be as below..,
Code at Flex app:
<mx:Button id=”btn” click=”b()”/>
<script>
private function b():void
{
ExternalInterface.call(“redirect”);
}
</script>
Code at JS/html wrapper:
<script language=”javascript”>
function redirect()
{
window.location.href=”http://www.google.com/”
}
</script>
Now on click Button the page will travel to the Google Page.

February 1, 2008 at 8:50 am |
[...] function in the JS and call that function from Flex APP using the ExternalInterface method call(), [previous post describes this call] with a button, the the JS function is raised and the Page is [...]
July 14, 2008 at 9:34 am |
Hi i used this above javascript coding for page navigation using button. But iam getting error in window property is not known.
How to solve this one, its a separate js file to be included int mx:script or how to do this?
Tell me..
July 14, 2008 at 2:44 pm |
Hi
the code
function redirect()
{
window.location.href=”http://www.google.com/”
}
should be in the html page of your Application, For Example i have a Application like FristFlexApplication in Flex Builder then the FlexBuilder Creates a Html page with the same name check it inthe bin-debug folder of your Project if using Flex Builder.
If this is not clear to you , paste the code your using i will guide you from that.
regards,
kumar.
August 28, 2008 at 6:10 am |
well this is useful… (at least for me)
very thanks
——————————–
travel vacation
November 26, 2009 at 12:05 pm |
it is so much usefull for me