nihavend opened a new issue #527: Nested states are not behave as expected
URL: https://github.com/apache/royale-asjs/issues/527
 
 
   "button1" in the source below should never be shown until the state is set 
to "jobDetailState" 
   but, it looks like the parent container excludeFrom tag overwrites the 
nested state condition includeIn and when the state changed to "loggedInState" 
"button1" is shown.
   
   At the bottom the "nevershown" button which has the same state condition 
with "button1" is never shown as expected because it is not a nested component.
   
   
        <?xml version="1.0" encoding="utf-8"?>
        <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
                                   
xmlns:s="library://ns.apache.org/royale/spark"
                                   xmlns:mx="library://ns.apache.org/royale/mx"
                                   paddingBottom="0" paddingTop="0" 
paddingLeft="0" paddingRight="0"
                                   height="100%" width="100%" 
                                   creationComplete="onCreationComplete()"
                                   >
                
                <fx:Metadata>
                </fx:Metadata>
                
                <s:states>
                        <s:State name="loggedOutState"/>
                        <s:State name="loggedInState"/>
                        <s:State name="jobDetailState"/>
                </s:states>
                
                <fx:Script>
                        <![CDATA[
                                
                                import mx.formatters.DateFormatter;
                                import org.apache.royale.utils.Timer;
                                
                                [Bindable] 
                                var time:String;
                                
                                private var ticker:Timer;
                                
                                [Bindable]
                                private var counter:Number = 0;
                                
                                protected function 
button_clickHandler(event:MouseEvent):void {
                                        if(currentState == "loggedOutState") {
                                                currentState = "loggedInState";
                                        } else if(currentState == 
"loggedInState") {
                                                currentState = "loggedOutState";
                                        }                               
                                }
                                
                                public function showTime():void {
                                        ticker = new Timer(1,1);
                                        ticker.addEventListener(Timer.TIMER, 
onTimerComplete);
                                        ticker.start();
                                        
                                        COMPILE::JS
                                                {
                                                        var d = new Date();
                                                        time = 
d.toLocaleTimeString() + ' ' + d.toLocaleDateString();
                                                        
                                                }
                                }
                                
                                public function onCreationComplete():void {
                                        showTime();
                                }
                                
                                public function 
onTimerComplete(event:Timer):void {
                                        showTime();
                                        counter ++;
                                } 
                                
                                
                        ]]>
                </fx:Script>
                
                <fx:Declarations>
                </fx:Declarations>      
                
                <s:layout>
                        <s:VerticalLayout gap="10" paddingRight="10" 
paddingLeft="10" paddingTop="10" paddingBottom="20" />
                </s:layout>
                
                <s:Button id="button" width="200" label="Show/Hide" 
click="button_clickHandler(event)"/>
                
                <mx:Panel title="Form Container Example"
                                  paddingBottom="10" paddingTop="10" 
paddingLeft="10" paddingRight="10"
                                  height="100%" width="100%">
                        
                        <mx:Text width="100%"
                                         text="Moving from one form field to 
another triggers the validator."/>
                        
                        <mx:Form width="100%" height="100%" 
excludeFrom="loggedOutState" >
                                <mx:FormHeading label="Enter values into the 
form."/>
                                
                                <mx:FormItem label="First name" >
                                        <mx:TextInput id="fname" width="200"/>
                                </mx:FormItem>
                                
                                <mx:FormItem label="Date of birth (mm/dd/yyyy)">
                                        <mx:TextInput id="dob" width="200"/>
                                </mx:FormItem>
                                
                                <mx:FormItem includeIn="jobDetailState" >
                                        <s:Button id="button1" width="200" 
label="Time : {time}" />
                                </mx:FormItem>                  
                                
                                
                        </mx:Form>
                        
                </mx:Panel>
                
                <s:Button id="nevershown" includeIn="jobDetailState" 
label="Never Shown Button" />
                
        </s:Application>
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to