How can I initialize all TabNavigator Tabs upon a state change?

Here's the basic goal. I want to provide two views to the
user that display the same panels. I configured each view as a
separate state but I am having trouble initializing each of the tab
views since they are only created by Flex when the user first
selects it. I need them all created when the user changes to that
state so that I can insert my view objects. Does that make sense?
Ok, how about an example program. I define three view objects
in ActionScript which will be used in two different states. I use
AddChild to put them in the proper layout location. The problem is
with the Tab state. The AddChild operation only works for the first
tab because it is visible. The other two tabs don't get setup
properly. Can anyone help me resolve this?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical"
creationComplete="onCreationComplete()">
<mx:Script>
<![CDATA[
import mx.containers.VBox;
import mx.controls.Label;
[Bindable] public var view1:VBox;
[Bindable] public var view2:VBox;
[Bindable] public var view3:VBox;
private function onCreationComplete():void
var label1:Label = new Label();
var label2:Label = new Label();
var label3:Label = new Label();
label1.text = "This is view 1.";
label2.text = "This is view 2.";
label3.text = "This is view 3.";
view1 = new VBox();
view1.label = "View 1";
view1.addChild(label1);
view2 = new VBox();
view2.label = "View 2";
view2.addChild(label2);
view3 = new VBox();
view3.label = "View 3";
view3.addChild(label3);
currentState = "wizardState";
private function changeState():void
switch(stateBox.selectedItem.data)
case 0: currentState = 'wizardState'; break;
case 1: currentState = 'tabState'; break;
]]>
</mx:Script>
<mx:Panel id="mainPanel" title="Tab View Bug" width="400"
height="320"/>
<mx:ComboBox id="stateBox" change="changeState()">
<mx:dataProvider>
<mx:Object label="Wizard" data="0"/>
<mx:Object label="Tabbed" data="1"/>
</mx:dataProvider>
</mx:ComboBox>
<mx:states>
<mx:State name="wizardState">
<mx:AddChild relativeTo="{mainPanel}"
position="lastChild">
<mx:HBox width="100%" height="100%"
verticalAlign="top">
<mx:ToggleButtonBar id="wizardButtonBar" width="20%"
direction="vertical"
dataProvider="{wizardViewStack}"/>
<mx:ViewStack id="wizardViewStack" width="80%"
selectedIndex="{wizardButtonBar.selectedIndex}"/>
</mx:HBox>
</mx:AddChild>
<mx:AddChild target="{view1}"
relativeTo="{wizardViewStack}" position="lastChild"/>
<mx:AddChild target="{view2}"
relativeTo="{wizardViewStack}" position="lastChild"/>
<mx:AddChild target="{view3}"
relativeTo="{wizardViewStack}" position="lastChild"/>
</mx:State>
<mx:State name="tabState">
<mx:AddChild relativeTo="{mainPanel}"
position="lastChild">
<mx:TabNavigator id="tabViewStack" width="100%"
height="100%">
<mx:VBox label="Tab 1" id="tab1"/>
<mx:VBox label="Tab 2" id="tab2"/>
<mx:VBox label="Tab 3" id="tab3"/>
</mx:TabNavigator>
</mx:AddChild>
<mx:AddChild target="{view1}" relativeTo="{tab1}"
position="lastChild"/>
<mx:AddChild target="{view2}" relativeTo="{tab2}"
position="lastChild"/>
<mx:AddChild target="{view3}" relativeTo="{tab3}"
position="lastChild"/>
</mx:State>
</mx:states>
</mx:Application>

Ok, here is an even simpler scenario. I take each view from
the default state and put them in the new tab view when the state
changes. If you compile and run this example, the only view that
makes it into the tabview is the one that was active when the state
changed. Why is that?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical">
<mx:Script>
<![CDATA[
private function changeState():void
switch(stateBox.selectedItem.data)
case 0: currentState = ''; break;
case 1: currentState = 'tabState'; break;
]]>
</mx:Script>
<mx:Panel id="mainPanel" title="Tab View Bug" width="400"
height="320">
<mx:HBox id="wizardView" width="100%" height="100%"
verticalAlign="top">
<mx:ToggleButtonBar id="wizardButtonBar" width="20%"
direction="vertical"
dataProvider="{wizardViewStack}"/>
<mx:ViewStack id="wizardViewStack" width="80%"
selectedIndex="{wizardButtonBar.selectedIndex}"
creationPolicy="all">
<mx:Canvas id="view1" label="Part 1" >
<mx:TextInput text="This is view 1"/>
</mx:Canvas>
<mx:Canvas id="view2" label="Part 2">
<mx:TextInput text="This is view 2"/>
</mx:Canvas>
<mx:Canvas id="view3" label="Part 3">
<mx:TextInput text="This is view 3"/>
</mx:Canvas>
</mx:ViewStack>
</mx:HBox>
</mx:Panel>
<mx:ComboBox id="stateBox" change="changeState()">
<mx:dataProvider>
<mx:Object label="Wizard" data="0"/>
<mx:Object label="Tabbed" data="1"/>
</mx:dataProvider>
</mx:ComboBox>
<mx:states>
<mx:State name="tabState">
<mx:AddChild relativeTo="{mainPanel}"
position="lastChild">
<mx:TabNavigator id="tabView" width="100%" height="100%"
creationPolicy="all">
<mx:Canvas label="Tab 1" id="tab1"/>
<mx:Canvas label="Tab 2" id="tab2"/>
<mx:Canvas label="Tab 3" id="tab3"/>
</mx:TabNavigator>
</mx:AddChild>
<mx:RemoveChild target="{view1}"/>
<mx:AddChild target="{view1}" relativeTo="{tab1}"/>
<mx:RemoveChild target="{view2}"/>
<mx:AddChild target="{view2}" relativeTo="{tab2}"/>
<mx:RemoveChild target="{view3}"/>
<mx:AddChild target="{view3}" relativeTo="{tab3}"/>
<mx:RemoveChild target="{wizardView}"/>
</mx:State>
</mx:states>
</mx:Application>

Similar Messages

  • How can i print all the tab pages not just the first page (tab)

    how can i print all the tab pages not just the first page (tab)

    You would need to do this programmatically. Here's one way:
    Attachments:
    Example_VI_BD6.png ‏3 KB

  • A lot of tabs loads and tells me there was a problem loading the page. How can I stop all the tabs loading because ist slows down Firefox.

    When I open Firefox, a lot of tabs try to open at the same time. They all say Problem loading the page. It happened after I tried to download a owners manual for Harley Davidson motor cycles. How can I stop all but one tab from opening.

    This can be a problem with the file [http://kb.mozillazine.org/sessionstore.js sessionstore.js] and sessionstore.bak in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder]
    Delete [http://kb.mozillazine.org/sessionstore.js sessionstore.js] and sessionstore.bak in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder]
    If you see files sessionstore-##.js with a number in the left part of the name like sessionstore-1.js then delete those as well.
    See:
    * http://kb.mozillazine.org/Session_Restore

  • How can i restore all my tabs of mozilla after profile movement ?

    I am working in call center here users open so many tabs and when we they moved to new system they want to restore all the tabs at new location. So , how i can restore all the tabs after profile movement like i can restore their pst

    You can make a backup copy of the sessionstore.js file that stores session data.
    *http://kb.mozillazine.org/sessionstore.js
    You can use this button to go to the currently used Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)

  • How can I open all the tabs saved in a sub folder of the bookmark menu simultaneously in a single click/command ?

    I have saved some of the related tabs in a common sub folder in the bookmarks list and whenever i have to open this tabs always i have to open them individually coz the 'open all in new tabs' option is not available for subfolder, so is there any command or click available from which i can directly open all the saved tabs of a subfolder simultaneously in one single attempt ? using vaio laptop, windows 7 basic, firefox version 6.0.2 !

    yes i do that on my desktop but i dont have middle click option on laptop and even in the right click context the ''open all in tabs'' option is desplayed but is in light color i.e. not functional. Is this a problem with windows 7 or missing plugin or add on could help or extension of some sort ? please help !

  • How can I bookmark all my tabs in a bokmarkfolder without adding them one at a time in the newer versions of firefox?

    In older versions of firefox a had the ability to instantly add all my open tabs to a folder of bookmarks. I really liked this feature, it was very convenient when I was doing something and was interrupted and wanted to be able to get back to where I was at a later time.
    However I have not been able to find this feature in the newer versions of firefox.
    Where do i find it?
    I hope you have not removed it, because that would be a real shame.

    Some menu entries in the main menu bar are hidden if you use the mouse and only appear if you use the keyboard to open the menu (Bug 626825).<br />
    You can see the difference if you use Alt+F to open the File menu or other menus like the Edit menu (Alt+E) and Bookmarks menu (Alt+B) and compare that to what you see if you use the mouse to open the menu after you have made the menu bar visible by tapping Alt or by pressing F10.
    * "Bookmark All Tabs" (Shift+Ctrl+D) no longer shows in the Bookmarks menu unless you open the Bookmarks menu via the keyboard (Alt + B).
    * "Bookmark All Tabs" can be accessed via the right-click context menu of a tab on the tab bar.
    * "Bookmark This Page" can be accessed via the right-click context menu of that browser page.
    See also:
    * https://support.mozilla.org/kb/how-do-i-use-bookmarks
    * Bookmark All: https://addons.mozilla.org/firefox/addon/bookmark-all/

  • How can i get all the tabs i had last time?

    when i closed my browser and all tabs, then opened the browser it didn't restore my session or give the option to restore it, i have restore tabs from last time checked. I really need to restore that session, there were very important tabs that i don't remember the addresses for, and they aren't in history because i didn't load some of them for a long time. Is there any way to restore?

    Hi bncase, how long were you keeping the important tabs open? You may well have backups of sessionstore.js and/or sessionstore.bak which contain at least some of the tabs. You might be able to restore them to a different location and take a peek inside.
    Another possibility is to try the "Previous Versions" feature. See: http://windows.microsoft.com/en-US/windows7/Previous-versions-of-files-frequently-asked-questions When you right-click either sessionstore.bak or sessionstore.js and choose Properties you may find files available on the Previous Versions tab. Since I find system restore to be somewhat unreliable, it's probably a good idea to back up any current files you might want to load again before restoring any of those previous versions. As always, make sure Firefox is closed before restoring, or your changes may quickly be overwritten.

  • The font i used in my KEYNOTE presentation is not available when you upload it to the cloud.  So, now my  text boxes are all messed up.  How can I select ALL font boxes of presentation and change (at least) the font style?

    I have a large presentation that I need to access from the cloud THIS SATURDAY.  Now, after uploading from my iMac to Cloud, the font is all messed up because the font I selected on my mac is NOT available on the Keynote Cloud....so capitalization is wrong, inconsistent, etc.
    Is there a quick way to select all text and change the style?  Help..I am running out of time!

    What's the URL of the page?
    In the mean time clear the cache and reload the page.

  • On I-Mac, how can I close all tabs at the same time?

    On I-Mac, how can I close all tabs at the same time?
    I use Mozilla Firefox for internet.

    Not an Apple product, have you visited:
    https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-qu ickly

  • I have a new IMAC 5k running Yosemite and when I log in I am asked a whole series of questions as to what keychain can access. How can I authorise all of these to be available upon login? Items concerned are such as "Talagent", "Messages agent" etc

    I have a new IMAC 5k running Yosemite and when I log in I am asked a whole series of questions as to what keychain can access. How can I authorise all of these to be available upon login? Items concerned are such as "Talagent", "Messages agent" etc

    Back up all data before proceeding.
    Launch the Keychain Access application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    Select the login keychain from the list on the left side of the Keychain Access window. If your default keychain has a different name, select that.
    If the lock icon in the top left corner of the window shows that the keychain is locked, click to unlock it. You'll be prompted for the keychain password, which is the same as your login password, unless you've changed it.
    Right-click or control-click the login entry in the list. From the menu that pops up, select
              Change Settings for Keychain "login"
    In the sheet that opens, uncheck both boxes, if not already unchecked.
    From the menu bar, select
              Keychain Access ▹ Preferences... ▹ First Aid
    There are four checkboxes in the window that opens. Check all of them. if they're not already checked. Close the window.
    Select
              Keychain Access ▹ Keychain First Aid
    from the menu bar and repair the keychain. Quit Keychain Access.
    If you use iCloud Keychain, open the iCloud preference pane and uncheck the Keychain box. You'll be prompted to delete the local iCloud keychain. Confirm. Then re-check the box. Follow one of the procedures described in this support article to set up iCloud Keychain on an additional device.

  • How can I import all of my bookmarks and not just some of the like the import tab does?

    I tried to import my bookmarks but it took only a few bookmarks and left most of my list behind. I tried the import from IE many times and get the same result so how can I get all my bookmarks moved over?

    If you have problems with importing the IE Favorites in Firefox then export the favorites in IE to an HTML file and import that file in the Firefox Bookmarks Manager.
    If you do not have the menu bar in IE then right-click the toolbar at the top to enable the Menu Bar.
    * Export the favorites in IE to an HTML file (bookmarks.html):<br>File > Import and Export
    * Import the HTML file in Firefox:<br>Bookmarks > Show All Bookmarks > Import & Backup > Import Bookmarks from HTML: From File
    See "Import from another browser" and "Import from file":
    * http://kb.mozillazine.org/Import_bookmarks

  • How can I get all of my purchased iTunes to show up in my "MUSIC" on my iPhone5?

    I've purchase several iTunes songs. Some of them show up in my "MUSIC" but some don't.  How can I get all of them to show up in the "MUSIC" app/tab?  Currently the only way I can play some of them is to go to ITunes where they show as "purchased".

    Mac OS X & Mountain Lion Community
    https://discussions.apple.com/community/mac_os
    https://discussions.apple.com/community/mac_os/os_x_mountain_lion?view=discussio ns
    https://www.apple.com/support/osx/
    https://www.apple.com/support/quickassist/
    http://www.apple.com/support/mac101/help/
    MacBook Series Forums 
    https://discussions.apple.com/community/notebooks?view=discussions
    http://www.apple.com/support/macbookpro
    http://www.ehow.com/how_5873496_fonts-available-mac-ms-word.html
    Using Font Book: http://support.apple.com/kb/HT2509

  • Have multiple accounts, how can I move all products into one account?

    have multiple accounts, how can I move all products into one account?

    Backup Software Recommendations
    Carbon Copy Cloner
    Data Backup
    Deja Vu
    SuperDuper!
    Synk Pro
    Tri-Backup
    Others may be found at VersionTracker or MacUpdate.
    Visit The XLab FAQs and read the FAQ on backup and restore.  Also read How to Back Up and Restore Your Files.
    Or you can simply use the Restore option of Disk Utility to clone the drive to the backup:
    Clone using Restore Option of Disk Utility
    Open Disk Utility from the Utilities folder.
    Select the destination volume from the left side list.
    Click on the Restore tab in the DU main window.
    Check the box labeled Erase destination.
    Select the destination volume from the left side list and drag it to the Destination entry field.
    Select the source volume from the left side list and drag it to the Source entry field.
    Double-check you got it right, then click on the Restore button.
    Destination means the external backup drive. Source means the internal startup drive.

  • I just bought a new ITOUCH 4th Generation how can i transfer all my apps from my old ITOUCH 2nd Generation? Is it possible?

    I just bought a new ITOUCH 4th Generation how can i transfer all my apps from my old ITOUCH 2nd Generation? Is it possible?I just bought a new ITOUCH 4th Generation how can i transfer all my apps from my old ITOUCH 2nd Generation? Is it possible?
    Thanks

    If you want to transfer app dat you need to restore the new iPod from the backup of the old iPod.  Restoring from backup will result in your new iPod being just like your old iPOd except you will have to reenter keychain items like passwords since those only get restore to the same device upon a restore.

  • Only the first page is printed reduced as setup. All pages afterward are full size with information cut off. Recent problem. Can print from Safari just fine. How can I get all pages to be reduced size?

    Question
    Printing internet pages
    Reduced print size
    Only the first page is reduced and printed as desired
    All pages after the first page are full size with information cut off
    Recent problem never seen before
    Can print from Safari and other software just fine
    How can I get all pages to be reduced size?

    One suggestion worked from the Firefox prints incorrectly link mentioned above by mha007. I'm thrilled since this has been annoying me for weeks. Thanks mha007!
    Reset all Firefox printer settings
    # Open your profile folder:
    # On the menu bar, click on the Help menu and select Troubleshooting Information. The Troubleshooting Information tab will open.
    # Under the Application Basics section, click on Show in Finder. A window with your profile folder will open.
    # Note: If you are unable to open or use Firefox, follow the instructions in Finding your profile without opening Firefox.
    # On the menu bar, click on the Firefox menu and select Quit Firefox.
    # In your profile folder, copy the prefs.js file to another folder to make a backup of it.
    # Open the original prefs.js file in a text editor (such as TextEdit).
    # Remove all lines in prefs.js that start with print. and save the file.
    # If something goes wrong when you open Firefox, close it again and overwrite prefs.js with the backup you made.

Maybe you are looking for