3 Replies Latest reply on May 22, 2010 4:38 AM by dfsafdf434

    Problem when moving between pages

    dfsafdf434

      Hi all,

       

      I have buit an interface in Flash Catalyst and imported it into FB to modify a few little things. However, when I run the application and move between the "pages" I built in Catalyst, I noticed that the pages dont reset at the top. By this I mean: if I scroll down a long page and click a "next" button, the following page wont begin at the top, it will display at the point where I scrolled to on the previous page.

       

      Is there a way to make a resulting page start at the top like it would if it were HTML?

       

      Thanks in advance!

        • 1. Re: Problem when moving between pages
          shyamp

          Hi,

          Try using a Scroller <s:Scroller> for the pages. Then, along with the change in state, you can have the vertical scrollbar go all the way to the top.
          The code would look like this:

           

          currentState = 'Page2';

          myScroller.verticalScrollBar.value = myScroller.verticalScrollBar.minimum;

           

          Regards,

          Shyam

          • 2. Re: Problem when moving between pages
            dfsafdf434 Level 1

            Heya!

             

            Thanks for the reply...!

             

            When i import the fxp file in to FB the pages are already built. How would I go about putting the pages in a scroller (since catalyst doesnt already do it)?
            I can drag out the Scroller component, but it doesn seem as if I can build anything in it. Sorry... I am quite new to this.

             

            I made a quick little example and pasted the code below. Would I be able to modify this in some way?

             

            Thanks again for your assistance... it is much appreciated!

             

             

            <?xml version="1.0" encoding="utf-8"?>
            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:fc="http://ns.adobe.com/flashcatalyst/2009" xmlns:components="components.*" xmlns:ATE="http://ns.adobe.com/ate/2009" xmlns:ai="http://ns.adobe.com/ai/2009" xmlns:flm="http://ns.adobe.com/flame/2008" xmlns:lib="assets.graphics.Untitled_1.*" backgroundColor="#FFFFFF" height="900" preloaderChromeColor="#FFFFFF" width="1040">
                <fx:Style source="Main.css"/>
                <fx:Script><![CDATA[

             

                    protected function button_clickHandler():void
                    {
                        currentState='Page2';
                    }

             

                    ]]></fx:Script>
                <s:states>
                    <s:State fc:color="0xcc0000" name="Page1"/>
                    <s:State name="Page2"/>
                </s:states>
                <fx:DesignLayer d:id="2" d:userLabel="Layer 1">
                    <s:Button includeIn="Page1" label="Button" x="337" y="191" click="button_clickHandler()"/>
                </fx:DesignLayer>
                <fx:Private>
                    <fc:Guide x="33"/>
                    <fc:Guide x="230"/>
                    <fc:Guide x="1002"/>
                    <fc:Guide y="290"/>
                    <fc:Guide y="314"/>
                    <fc:Guide y="221"/>
                </fx:Private>
            </s:Application>

            • 3. Re: Problem when moving between pages
              dfsafdf434 Level 1

              Alright.... got it figured out.

               

              All you need to do is add:

               

              ExternalInterface.call("window.scrollTo",  0, 0);

               

              to the "button_clickHandler" after importing into FB.