11 Replies Latest reply on Dec 31, 2008 10:46 AM by Newsgroup_User

    Exported Flex Application Refresh Rate (SWF)

    alice_data Level 1
      Hi,

      I am wondering if anyone on this list has seen anything like this, and hopefully someone could help me with fixing it.
      I have successfully created a full fledged application that contains 8 states in all, with various data service input and output as a user uses the application. The question is this, when a user writes to the database, and tries to reload and look at another entry by clicking on the reload button that I created, even though it has long passed the "time requirement" as handled by the back-end coding, the user sees only the first entries that originally exists in the database. I do not have sleep function throughout my Actionscript or PHP within this process.

      However, if I open another browser and tries to see it by reloading the entire application again (in SWF format), everything is normal and displayed correctly.

      Is there a refresh rate issue with Flex in terms of displaying information from another table after it has been written in? How would I go about fixing it?

      Thanks for your help. I hope I am making sense here.

      Alice
        • 1. Re: Exported Flex Application Refresh Rate (SWF)
          Level 7

          "alice_data" <webforumsuser@macromedia.com> wrote in message
          news:gjdqbe$sc8$1@forums.macromedia.com...
          > Hi,
          >
          > I am wondering if anyone on this list has seen anything like this, and
          > hopefully someone could help me with fixing it.
          > I have successfully created a full fledged application that contains 8
          > states in all, with various data service input and output as a user uses
          > the
          > application. The question is this, when a user writes to the database, and
          > tries to reload and look at another entry by clicking on the reload button
          > that
          > I created, even though it has long passed the "time requirement" as
          > handled by
          > the back-end coding, the user sees only the first entries that originally
          > exists in the database. I do not have sleep function throughout my
          > Actionscript
          > or PHP within this process.
          >
          > However, if I open another browser and tries to see it by reloading the
          > entire application again (in SWF format), everything is normal and
          > displayed
          > correctly.
          >
          > Is there a refresh rate issue with Flex in terms of displaying
          > information
          > from another table after it has been written in? How would I go about
          > fixing it?
          >
          > Thanks for your help. I hope I am making sense here.

          There are all sorts of things that could be going on here. Hard to say
          without seeing your code.


          • 2. Re: Exported Flex Application Refresh Rate (SWF)
            alice_data Level 1
            Hi, Amy:

            This is the code of the state the users would enter when they make attempts to go back and forth to look at information from another table:

            <mx:State name="Scenario Show">
            <mx:AddChild relativeTo="{scenario_build}" position="firstChild">
            <mx:ButtonBar horizontalGap="5" id="menubar" itemClick="clickHandler2();" x="10" paddingTop="18" paddingBottom="3"
            y="0">
            <mx:dataProvider>
            <mx:Array>
            <mx:String>Back to Main Interface</mx:String>
            </mx:Array>
            </mx:dataProvider>
            </mx:ButtonBar>
            </mx:AddChild>
            <mx:AddChild relativeTo="{menubar}" position="before">
            <mx:Spacer height="30"/>
            </mx:AddChild>
            <mx:AddChild relativeTo="{desc}" position="before">
            <mx:DataGrid width="416" height="597" id="scenario_display" initialize="scenario_find.send()"
            itemClick="itemClickEvent(event);"
            dataProvider="{scenario_find.lastResult.scenarios.scenario}" >
            <mx:columns>
            <mx:DataGridColumn headerText="Scenario ID" visible="false"
            dataField="scenario_id"/>
            <mx:DataGridColumn headerText="Scenario Name"
            dataField="scenario_name"/>
            </mx:columns>
            </mx:DataGrid>
            </mx:AddChild>
            <mx:RemoveChild target="{desc}"/>
            <mx:RemoveChild target="{tn2}"/>
            <mx:SetProperty target="{hbo1}" name="x" value="0"/>
            <mx:SetProperty target="{hbo1}" name="y" value="51"/>
            <mx:SetProperty target="{scenario_build}" name="layout" value="absolute"/>
            <mx:SetProperty target="{hbo1}" name="width" value="460"/>
            <mx:SetProperty target="{hbo1}" name="height" value="668"/>
            <mx:AddChild relativeTo="{scenario_build}" position="lastChild">
            <mx:Label id="scenario1" text="" visible="false"/>
            </mx:AddChild>
            <mx:RemoveChild target="{menubar0}"/>
            </mx:State>

            When users push the button "Load" to see the state above, the following is the Actionscript:
            private function clickHandler1(event:ItemClickEvent):void {
            if (String(event.index) == '0') {
            currentState="Scenario Show";
            }
            }
            private function clickHandler2():void {
            currentState="";
            }
            Does this help you with answering my question?
            Thanks for your help.

            Alice
            • 3. Re: Exported Flex Application Refresh Rate (SWF)
              Level 7

              "alice_data" <webforumsuser@macromedia.com> wrote in message
              news:gjdvd0$59l$1@forums.macromedia.com...
              > Hi, Amy:
              >
              > This is the code of the state the users would enter when they make
              > attempts
              > to go back and forth to look at information from another table:
              >
              > <mx:State name="Scenario Show">
              > <mx:AddChild relativeTo="{scenario_build}"
              > position="firstChild">
              > <mx:ButtonBar horizontalGap="5" id="menubar"
              > itemClick="clickHandler2();" x="10" paddingTop="18" paddingBottom="3"
              > y="0">
              > <mx:dataProvider>
              > <mx:Array>
              > <mx:String>Back to Main Interface</mx:String>
              >
              > </mx:Array>
              > </mx:dataProvider>
              > </mx:ButtonBar>
              > </mx:AddChild>
              > <mx:AddChild relativeTo="{menubar}" position="before">
              > <mx:Spacer height="30"/>
              > </mx:AddChild>
              > <mx:AddChild relativeTo="{desc}" position="before">
              > <mx:DataGrid width="416" height="597" id="scenario_display"
              > initialize="scenario_find.send()"
              > itemClick="itemClickEvent(event);"
              > dataProvider="{scenario_find.lastResult.scenarios.scenario}" >
              > <mx:columns>
              > <mx:DataGridColumn headerText="Scenario ID" visible="false"
              > dataField="scenario_id"/>
              > <mx:DataGridColumn headerText="Scenario Name"
              > dataField="scenario_name"/>
              > </mx:columns>
              > </mx:DataGrid>
              > </mx:AddChild>
              > <mx:RemoveChild target="{desc}"/>
              > <mx:RemoveChild target="{tn2}"/>
              > <mx:SetProperty target="{hbo1}" name="x" value="0"/>
              > <mx:SetProperty target="{hbo1}" name="y" value="51"/>
              > <mx:SetProperty target="{scenario_build}" name="layout"
              > value="absolute"/>
              > <mx:SetProperty target="{hbo1}" name="width" value="460"/>
              > <mx:SetProperty target="{hbo1}" name="height" value="668"/>
              > <mx:AddChild relativeTo="{scenario_build}" position="lastChild">
              > <mx:Label id="scenario1" text="" visible="false"/>
              > </mx:AddChild>
              > <mx:RemoveChild target="{menubar0}"/>
              > </mx:State>
              >
              > When users push the button "Load" to see the state above, the following is
              > the
              > Actionscript:
              > private function clickHandler1(event:ItemClickEvent):void {
              > if (String(event.index) == '0') {
              > currentState="Scenario Show";
              > }
              > }
              > private function clickHandler2():void {
              > currentState="";
              > }
              > Does this help you with answering my question?
              > Thanks for your help.

              It looks like your service only gets called once--when the DataGrid
              refreshes. If you want the data to refresh, you'll either need to call it
              again or just update the dataProvider with what's changed. This is kind of
              difficult the way you have it set up binding to lastResult instead of
              transferring it first to a variable that you can work with.

              HTH;

              Amy


              • 4. Re: Exported Flex Application Refresh Rate (SWF)
                alice_data Level 1
                Hi, Amy:

                Well, I thought what I was doing was not refreshing the screen. What the user may see in the first stage may be the DataGrid taken from table A, and he then clicks on the button to see information from table B. When he clicks on button A again and creates a new entry and then pushes the button B again, (all are on a buttonbar), he only sees the information from before he inserts the new entry.

                When the user executes the httpservice from button B, the provider of the DataGrid is different. If refreshing would solve this problem, are there examples around I might check out on how to restructure my code?

                Thanks for your help.

                Alice
                • 5. Re: Exported Flex Application Refresh Rate (SWF)
                  Level 7

                  "alice_data" <webforumsuser@macromedia.com> wrote in message
                  news:gjfh80$64u$1@forums.macromedia.com...
                  > Hi, Amy:
                  >
                  > Well, I thought what I was doing was not refreshing the screen. What the
                  > user may see in the first stage may be the DataGrid taken from table A,
                  > and he
                  > then clicks on the button to see information from table B. When he clicks
                  > on
                  > button A again and creates a new entry and then pushes the button B again,
                  > (all
                  > are on a buttonbar), he only sees the information from before he inserts
                  > the
                  > new entry.
                  >
                  > When the user executes the httpservice from button B, the provider of
                  > the
                  > DataGrid is different. If refreshing would solve this problem, are there
                  > examples around I might check out on how to restructure my code?
                  >
                  > Thanks for your help.

                  If the code that you posted is the code that applies, the only time you are
                  calling send on the HTTPService is in the initialize event for the DataGrid
                  itself. What I am trying to tell you is that in order to have a different
                  result set, you need to call it again somewhere else.

                  If the code that you posted is _not_ complete, you've wasted your time and
                  mine and it's impossible for me to help you at this stage.

                  -Amy


                  • 6. Re: Exported Flex Application Refresh Rate (SWF)
                    alice_data Level 1
                    Hi, Amy:

                    The code you see here is what gets to be executed every time in terms of the HTTPService, and from what you are saying, it sounds like I need to call another state when i recall the service to have the updated results.

                    I am assuming that the problem I was having is probably because my Flex SWF file is stored on one server, with the database and everything else on another, and therefore the "information transmitting" might be a little out of hand.

                    Thanks again.

                    Alice
                    • 7. Re: Exported Flex Application Refresh Rate (SWF)
                      Level 7

                      "alice_data" <webforumsuser@macromedia.com> wrote in message
                      news:gjg29v$pro$1@forums.macromedia.com...
                      > Hi, Amy:
                      >
                      > The code you see here is what gets to be executed every time in terms of
                      > the
                      > HTTPService, and from what you are saying, it sounds like I need to call
                      > another state when i recall the service to have the updated results.

                      No, I am saying that you are _not_ calling the service again, since the
                      DataGrid's initialize event will hapen only once.


                      • 8. Re: Exported Flex Application Refresh Rate (SWF)
                        alice_data Level 1
                        Hi, Amy:

                        Sorry, what I meant is that since I am calling it again for the time being, I could switch the state the user is originally viewing to another state that contains the same service so I could call the HTTPService() again.

                        Am I missing something of what you are saying here?

                        Alice
                        • 9. Re: Exported Flex Application Refresh Rate (SWF)
                          Level 7

                          "alice_data" <webforumsuser@macromedia.com> wrote in message
                          news:gjg3ab$r16$1@forums.macromedia.com...
                          > Hi, Amy:
                          >
                          > Sorry, what I meant is that since I am calling it again for the time
                          > being,
                          > I could switch the state the user is originally viewing to another state
                          > that
                          > contains the same service so I could call the HTTPService() again.
                          >
                          > Am I missing something of what you are saying here?

                          And then when they need to see it again, you'd add yet another state, and
                          another state, and another...?

                          Why not just add a send() call to the same service that gets called a
                          different way than the initialize() event of the DataGrid, like from a
                          button's click event?

                          Better yet, why not make it a separate function that you can call from
                          initialize or click or whereever, and then you can just use it when you need
                          it?


                          • 10. Re: Exported Flex Application Refresh Rate (SWF)
                            alice_data Level 1
                            Hi, Amy:

                            This is a great tip and possibly the greatest get around. I added the function call before I execute the state, and interestingly that did the trick.

                            Thanks!

                            Alice
                            • 11. Re: Exported Flex Application Refresh Rate (SWF)
                              Level 7

                              "alice_data" <webforumsuser@macromedia.com> wrote in message
                              news:gjgdvv$ald$1@forums.macromedia.com...
                              > Hi, Amy:
                              >
                              > This is a great tip and possibly the greatest get around. I added the
                              > function call before I execute the state, and interestingly that did the
                              > trick.
                              >
                              > Thanks!

                              You're welcome :-)