Forward and back browser button to switch state

2010-06-03  来源:本站原创  分类:Flash  人气:297 

Flex browser manager that allows users to forward the browser back button to navigate application. Because the browser manager can track the status of the switch.
Said before, each state is a new interface, rather than a new page. However, the browser also allows switching between different states. How to do that? Look at the background.
BrowserManager: a Singleton manager for the browser and act as a proxy between applications. Use it to access the browser's address bar URL, which is to visit the document.location property similar to JavaScript. It has a getInstance () method returns a IBrowserManager class.
IBrowserManager: shared instance of the realization by the BrowserManager interface. init () method: initialize BrowserManager. fragment attributes: the current URL displayed in the browser address bar, the "#" after the section.

<?xml version="1.0"?>
<!-- states\StatesBrowserManager.mxml -->
<s:Application xmlns:fx=""
                        import mx.managers.BrowserManager;
                        import mx.managers.IBrowserManager;
                        import mx.utils.URLUtil;
                        // The search string value.
                        public var searchString:String;
                        //  An instance of the BrowserManager class  .
                        private var browserManager:IBrowserManager;
                        // When the application is complete.   BrowserManager.
                        public function initApp():void {
                                browserManager = BrowserManager.getInstance();
                                browserManager.addEventListener(BrowserChangeEvent.BROWSER_URL_CHANGE, parseURL);
                                browserManager.init("", "Browser Manager for View States");
                        //  When the user presses the go-ahead triggers an event when the button, the event processor from  URL The value in the received State, thereby  . With his
                        // Set the current status of the  .
                        private var stateFromURL:String;
                        private function parseURL(e:Event):void {
                                var o:Object = URLUtil.stringToObject(browserManager.fragment);
                                stateFromURL = o.state;
                        //  When you change address status changes  .
                        private function updateURL(myCurrentState:String):void {
                                var s:String = "state=" + myCurrentState;
                        //  When you press the go button to execute the method  .
                        //  It will change the State, as well as the call  updateURL() Method to change the  URL.
                        public function doSearch():void {
                                currentState = "results";
                                searchString = searchInput.text;
                        //  Click on the reset button to execute the method  , This method is the state changes to the default value, and change.  URL
                        public function reset():void {
                                currentState = '';
                                searchInput.text = "";
                                searchString = "";
                <!-- The state for displaying the search results -->
                <s:State name="default"/>
                <s:State name="results"/>
        <!-- In the default state, just show a panel
        with a search text input and button. -->
                         title="Search" title.results="Results"
                         width="10%" height="10%"
                         width.results="100%" height.results="100%">
                <s:SkinnableContainer defaultButton="{b}">
                        <s:Button includeIn="results"
                <s:TextInput includeIn="results"
                                          text="Search results for {searchString}"/>
  • Forward and back browser button to switch state 2010-06-03

    Flex browser manager that allows users to forward the browser back button to navigate application. Because the browser manager can track the status of the switch. Said before, each state is a new interface, rather than a new page. However, the browse

  • Switch state information stored 2010-08-30

    Systems often will exist Daliang De status information, Tebie is 0-1 Zhi information, Mouge Tiaojianshifou reached if there is a Gongneng, whether the success of a Caozuo so, Tong Chang's practice is to state the conditions of various numbers, use bo

  • Picture plus the Play button (with the play button to switch image) 2010-03-16

    Add the play button image toggle button with the picture links do not switch and switch

  • cisco switch command 2011-05-11

    switch> enable access to privileged mode switch # config terminal to enter global configuration mode switch (config) # hostname Set the hostname of the switch switch (config) # enable secret xxx password encrypted privilege set switch (config) # enab

  • Reprinted: activity state of preservation and maintenance of 2010-08-30

    More onSaveInstanceState () and onRetainNonConfigurationInstance () usage in the different needs of many users in anyway possible that Android will be triggered when switching screen onSaveInstanceState, the reduction will produce onRestoreInstanceSt

  • Original - Principles of Anatomy android Style Button to start from 2010-10-22

    Reproduced in the original statement at: blog Reference Forum Forum foreign android Reference: android Button principle The past few days is to see android SDK source, to encapsulate the

  • Cisco switch command a large sum <reserved> 2010-12-06

    cisco switches is quite common, so I study a little Cisco switch command a large sum up, come here to share with you, we hope to be useful. I have been targeted in terms of Cisco's equipment, Huawei can tell, according to manual inspection, configura

  • [Reserved] EXT core API Detailed Ext.widgets (fourth)-Button, SplitButton, CycleButton 2010-12-12

    Ext.Action action to implement a container out of the event, all of which can be shared among multiple containers, but if only Ext.Toolbar, Ext.Button and support the action interface:), because the container to achieve all of the follo

  • On the transfer screen, and the activity state of preservation [transfer] 2011-01-11

    Comparison onSaveInstanceState () and onRetainNonConfigurationInstance () usage in different demand For the Android platform, no matter for what purpose, are more or less need to jump in the number of Activities in the operation, including some syste

  • Android Browser学习十一 框计算模块-Titlebar 2014-09-03

    好久没有更新博客了, 为了不让过去看的代码忘掉, 现在开始坚持更新. 看看之前写的博文, 虽然和大神还有有很大却别, 但是一路走来还是很佩服自己. 年轻真好! 废话少说, Browser的Titlebar功能还是比较全面的, 有进度条, 可以显示输入网址, 搜索关键词等, 可以显示搜索联想词等, 还有 停止, 刷新等按钮. 先看一下其布局: 可以看到他包括一个 NavigationBar 一个ProgressView两大部分 <RelativeLayout xmlns:android="h

  • J2EE Design Patterns of State Mode 2010-04-22

    Design patterns, the concept is now everywhere, everyone has a hand inside the estimate, Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, in the book "Design Patterns - Element of Re-Useable Object-Oriented Software", this book . Ac

  • [Change] progressive realization of imitation QQ interface (II): mapping button three-state simulation 2010-03-19

    Demo program requires RingSDK library, see the article in question compiled the original link: , here go directly to the topic, explain how mapping button three-state simulation. The so-c

  • difference between forward and sendRedirect 2010-04-26

    Today saw the teacher under the Auspicious <<depth Java_WEB development insider>> sendRedirect and forward method of explanation, I feel it very thoroughly, Really good book. HttpServletResponse.sendRedirect and RequestDispatcher.forward metho

  • 10 you never heard of the browser 2010-05-06

    Reposted elsewhere: Stainless is a browser similar to Google Chrome, and Chrome have similar multi-process, and some better features, for example, you can browse in the different labels in different account to log on

  • Browser Debugging Tools 2010-06-17

    ff: firebug + YSlow, absolute artifacts. ie: 1.ietester + debugbar + Microsoft Script Debugger + companion.js. ie a debugging tool so much? Not the same as the division of labor, there is no further use, felt not easy to use, with firebug far is poor

  • State models (State) 2010-06-17

    I. Introduction If you are in the design of a traffic control program, may now be only three colors, it is possible you will write the following code in the form of its. TrafficLight code: package org.bestupon.dp.state; public class TrafficLight { pr

  • ImageButton image receive state 2010-06-30

    If you use some special effects such as press release go on the background of the focus this time is different To know which one to use is the way ImageButton btn = (ImageButton) findViewById (; int [] states = btn.getDrawableState (); for (

  • CSS rounded corners make the level auto-retractable button 2010-07-12

    Browser button (button, input) most of the style of system themes (safari and opera have their own style), making the pages, the browser want all the buttons have the same effect, they need to define their own style. Because the button is trying to d

  • android3G connection state judge 2010-09-12

    Android phone most of the support WIFI, GSM, 3G network, but can only use each time you connect the network certainly one of them. Some programs (such as: custom operators) must also require the use of specific network (such as: CMWAP, CTWAP, etc.),

  • Swing's perception switch 2010-09-23

    Swing today to learn how to switch perception, feeling pretty good In the case of default, Swing uses Metal perception, perception can change in two ways. The first is in a subdirectory of the installation of Java under the jre / lib a file