Advanced applications of browsermanager

Source: Internet
Author: User

Deep-link: I believe everyone is familiar with it. It mainly uses JS and framework technology to enable the embedded SWF page to use the browser's forward and backward buttons for navigation. If we use flex Bulder to publish a page, the page will have a deep link function by default. Careful readers will find that there is a history directory under the directory where the page is located, and the JS, framework, and CSS files related to deep links are all in it. So how can we use browsermanager to implement deep links?

1. Use browsermanager to implement deep data links

This function transfers data from the browser URL and the flex control. Of course, we also use the browser's forward and backward navigation buttons to view historical data.

We can use the browserchangeevents event of the browsermanager class to read and write data to the address bar link. The browserchangeevent is scheduled by the browsermanager instance at any time by entering text in the address bar or using the backward navigation button to change the browser URL. browser_url_change event, which calls the updatevalues method inside the flex control to change the value.

Click to view the instance effect, and click to view the following instance source code.

The above example shows how to read data from the browser URL and display the data value in the flex text input box. Specifically, when an application loads data, it reads data from the current URL and writes the firstname and lastname parameter values to the firstname and lastname text input boxes. When the values of the firstname and lastname text input boxes change, the setfragment method of browsermanager is called to change the firstname and lastname values of browser URLs.

2. Use browsermanager to implement deep container links

Use the browserchangeevents event of the browsermanager class to control the visibility of the Flex visual component and track its history.

The following uses URL snippets to control which components and containers in the flex application are visible. When an application is loaded, the browsermanager instance will be initialized to parse and process the browser URL. The updatecontainers method (the following code) determines which tab of the tabnavigator instance is visible. On the other hand, as long as the tab visibility of the tabnavigator instance changes, the selectedindex parameter of the URL segment is changed through the following code:

bm.setFragment( "selectedIndex=" + tabNav.selectedIndex );

This statement will change the browser URL and add the changes to the browser's historical records. If you want to copy and paste the current browser URL, it is directly linked to the selected tab.

Click to view the instance effect, and click to download the instance source code.

You may notice that the historymanagementenabled attribute is set to false because historymanager usually conflicts with the method that the application processes URL fragments. We use the browsermanager event to check whether the browser URL is changed and change the tab content accordingly. Each change to the visual tab will change the browser's history. You can use the forward and backward buttons to navigate to the previous or next visible tab.


This article from: Id = 142

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.