Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

16. Browser Communication > 16.6. Parse the URL via BrowserManager

16.6. Parse the URL via BrowserManager

Problem

You need to read and parse data from the browser’s current URL.

Solution

Use the BrowserManager and URLUtil classes to read and parse the current page URL.

Discussion

The following example shows how to read and parse the current page URL by using the BrowserManager and URLUtil classes, as well as how to write the parsed results to a mx:TextArea instance.

The URLUtil class has functions that will help you parse the different pieces of the current URL. When using deep linking within Flex 4, the URL is broken into two parts: the base and the fragment. The URL base is everything that is to the left of the # sign, and the fragment is everything to the right of the # sign. The fragment is used to pass values into a Flex application, and in history management. A properly constructed fragment can be parsed by the URLUtil.stringToObject() method into an ActionScript object that contains the values in the fragment, broken out into string values. Each name/value pair in the URL fragment should be delimited by a semicolon (;). Let’s look at an example:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint