Guys need help, I've spent a day trying to figure out whats the problem with
with this app. Its about programmatically resizing a Titlewindow. 

When I'm assigning the TitleWindow a new value for width, a portion of the 
window
seems to be clipped for no reason. Is this a bug? Is there a workaround for 
this?
Or am I just doing it wrong? If you will check the demo, it works as expected 
bec
I have set the viewStackDialogIndex to 2 (as initial value). But if you close 
the dialog box
and press the popup window again, clicking on "medium" and "large" item wont 
expand the 
window anymore.

The compiled app demo:
http://www.geocities.com/poweribo/TitleWindowTest.swf

The code in question:--------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%" 
height="100%">
    <mx:Script>
        <![CDATA[                    
            [Bindable]
            private var viewStackDialogIndex:int = 2;
            [Bindable]
            private var dynamicWidth:int = 565;
            
            private function displayDateDialog(event:Event):void {
                var item:Object = listOfThings.selectedItem;
                viewStackDialogIndex = item.dialog;
                
                if (item.dialog == "0") {
                    dynamicWidth = 170;        
                } else if (item.dialog == "1") {                    
                    dynamicWidth = 380;                    
                } else if (item.dialog == "2") {                    
                    dynamicWidth = 565;                    
                }
            }
        ]]>
    </mx:Script>

    <mx:Model id="Shortcuts">
      <someItems>
        <someItem label="Small" data="1" dialog="0"/>
        <someItem label="Medium" data="2" dialog="1"/>
        <someItem label="Large" data="3" dialog="2"/>
      </someItems>
    </mx:Model>
                    
    <mx:PopUpButton id="popUpButton" label="Please Select Item" 
openAlways="true">
        <mx:popUp>                
            <mx:TitleWindow id="titleWindow" 
                            showCloseButton="false" close="popUpButton.close()" 
 
                            width="{dynamicWidth}" height="280"
                            verticalScrollPolicy="off" 
horizontalScrollPolicy="off">
            
                <mx:HBox width="100%" height="100%" verticalScrollPolicy="off" 
horizontalScrollPolicy="off">
                                    
                    <mx:List id="listOfThings" 
                        dataProvider="{Shortcuts.someItem}" 
                        selectedIndex="2"
                        width="140" height="100%"
                        textAlign="left"  
                        click="displayDateDialog(event)">                       
     
                    </mx:List>
                            
                    <mx:VBox id="thisPane" width="100%" height="100%" 
verticalScrollPolicy="off" horizontalScrollPolicy="off">
                    
                        <mx:ViewStack id="myViewStack" width="100%" 
height="100%" 
                            selectedIndex="{viewStackDialogIndex}" 
verticalScrollPolicy="off" horizontalScrollPolicy="off">
                            
                            <mx:HBox label="aa" width="100%" height="100%"
                                      verticalScrollPolicy="off" 
horizontalScrollPolicy="off">
                                <mx:Text text="This is Small"/>
                            </mx:HBox>    
                                                                        
                            <mx:HBox label="bb" width="100%" height="100%" 
                                     verticalScrollPolicy="off" 
horizontalScrollPolicy="off">
                                <mx:Text text="This is Medium"/>                
         
                            </mx:HBox>
                            
                            <mx:HBox label="cc" width="100%" height="100%" 
                                     verticalScrollPolicy="off" 
horizontalScrollPolicy="off">    
                                <mx:Text text="This is Large"/>
                            </mx:HBox>                
                        </mx:ViewStack>
                        
                    </mx:VBox>
                </mx:HBox>                    
            </mx:TitleWindow>                
        </mx:popUp>
    </mx:PopUpButton>    
</mx:Application>

-------------------------------------------------------

Regards,
Stephen

Reply via email to