Hi Gabe and Josh,

yes, I am very green.

I just came up with this while working on it with chatgpt ai.

It is one way to solve multiple screens for a little while. I had to take a 
break. Josh rightfully so said it had some misleading stuff etc. but I was 
looking for an idea not the corrected code. I will have to slow down before i 
post next time. sorry.

Chatgpt is a wizard with some prompting.

thanks

<?xml version="1.0" encoding="UTF-8"?>
<j:Application xmlns:j="library://ns.apache.org/royale/jewel"
               xmlns:fx="http://ns.adobe.com/mxml/2009";
               width="100%" height="100%" applicationComplete="initApp()">
    
    <fx:Script>
        <![CDATA[
            private var currentState:String = 'homeScreen';

            private function goToAboutScreen():void {
                currentState = 'aboutScreen';
                updateView();
            }

            private function goToHomeScreen():void {
                currentState = 'homeScreen';
                updateView();
            }

            private function updateView():void {
                homeScreenGroup.visible = (currentState == 'homeScreen');
                aboutScreenGroup.visible = (currentState == 'aboutScreen');
            }

            // Initialize app view
            private function initApp():void {
                updateView();
            }
        ]]>
    </fx:Script>
    <j:initialView>
        <j:View style="padding: 10px;">
            <j:beads>
                <j:VerticalLayout gap="8"/>
            </j:beads>
            
    <!-- Group for home screen -->
    <j:Group id="homeScreenGroup" visible="true" width="100%" height="100%">
        <j:Label text="Welcome to the Home Screen!" width="100%" height="100%" 
/>
        <j:Button text="Go to About Screen"  click="goToAboutScreen()"/>
    </j:Group>

    <!-- Group for about screen -->
    <j:Group id="aboutScreenGroup" visible="false" width="100%" height="100%">
        <j:Label text="This is the About Screen" width="100%" height="100%" />
        <j:Button text="Back to Home"  click="goToHomeScreen()"/>
    </j:Group>
   </j:View>
 </j:initialView>

</j:Application>




Sent with Proton Mail secure email.

Reply via email to