Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8725459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:02:42+00:00 2026-06-13T08:02:42+00:00

I have a simple application: <s:Application xmlns:fx=http://ns.adobe.com/mxml/2009 xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx xmlns:local=*> <mx:ViewStack width=100% creationPolicy=all> <s:NavigatorContent

  • 0

I have a simple application:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:local="*">

    <mx:ViewStack width="100%" creationPolicy="all">
        <s:NavigatorContent width="100%">
            <local:TestGroup width="100%"/>
        </s:NavigatorContent>
        <s:NavigatorContent width="100%">
            <local:TestGroup width="100%"/>
        </s:NavigatorContent>
    </mx:ViewStack>

</s:Application>

My TestGroup is a bare Spark group. It has creationComplete method, where the width of the group is traced:

<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
         xmlns:s="library://ns.adobe.com/flex/spark" 
         xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="group1_creationCompleteHandler(event)">
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;

            protected function group1_creationCompleteHandler(event:FlexEvent):void
            {
                trace("internal group width: " + this.width)
            }

        ]]>
    </fx:Script>
</s:Group>

When I run the application, the first TestGroup has width of 1600 (which is about right), but the second one regardless of creationPolicy="all" and width="100%" is 0 (zero).

It turs out that ms:ViewStack doesn’t set width for components other than the selected one.

What is the logic behind this behavior?
How can I fix it so that my second group has a real width, and I can get it at the creation complete?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:02:42+00:00Added an answer on June 13, 2026 at 8:02 am

    You can listen to change event, that will be fired each time the selected group is changing.

    Only the current active group will give you her true width, so you can do someThing like this

    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:local="*">
    
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
    
                protected function onChange(event:Event):void
                {
                    if(myViewStack.selectedChild){
                        myViewStack.selectedChild.initMyGroup();  
                    }
                }
    
            ]]>
        </fx:Script>
    
        <mx:ViewStack id="myViewStack" width="100%" creationPolicy="all" change="onChange()">
            <s:NavigatorContent width="100%">
                <local:TestGroup width="100%"/>
            </s:NavigatorContent>
            <s:NavigatorContent width="100%">
                <local:TestGroup width="100%"/>
            </s:NavigatorContent>
        </mx:ViewStack>
    
    </s:Application>
    
    
    
    
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
             xmlns:s="library://ns.adobe.com/flex/spark" 
             xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
    
                public function initMyGroup():void
                {
                    trace("internal group width: " + this.width)
                }
    
            ]]>
        </fx:Script>
    </s:Group>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Window that looks like this: <Window x:Class=StackOverflowExample.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow
I'm writing a very simple flex application with mxml. I have many buttons, when
I have a simple web application which lets the user upload local user data
I have simple WinForms application where modifying Windows Registry. The problem is that in
I have a simple application that loads an unmanaged dll and passes a few
I have a simple application in which I need to let the user select
I have a simple application written in C# and .Net 2.0 that displays several
I have a simple application which basically consists of a line of buttons and
I have a simple application which takes a text and password, generates a text
Possible Duplicate: Stopping & Starting music on incoming calls I have a simple application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.