If you are working on an app with many screens/panes, etc. You proabbly want a 
router for browser navigation and links which will bring the user to the 
correct screen.

Look at the code here for a reference:

https://github.com/unhurdle/spectrum-royale/blob/master/SpectrumBrowser/src/view/BrowserRouter.mxml

You can specify the mapping of routes to components. You can also map routes to 
functions.


> On Mar 25, 2025, at 10:05 PM, Jim McNamara <jmcnamara10...@proton.me> wrote:
> 
> 
> 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