JavaScript function to travel to a WEB Page : redirect()

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 :


specify the link in the double quotes.


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()”/>


private function b():void




Code at JS/html wrapper:

<script language=”javascript”>

function redirect()





Now on click Button the page will travel to the Google Page.


7 Responses to JavaScript function to travel to a WEB Page : redirect()

  1. […] 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 […]

  2. Shankar says:

    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..

  3. kumargandhi says:

    the code

    function redirect()




    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.


  4. well this is useful… (at least for me)

    very thanks

    travel vacation

  5. kaushik says:

    it is so much usefull for me

  6. Tripper says:

    Great posting, enjoyable to read. well done!

  7. scripts | shop scripts | web scripts | website tools | tutorials | design | themes | php | html | html5 | clone…

    […]JavaScript function to travel to a WEB Page : redirect() « flex on blog – by kumar[…]…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: