3 Replies Latest reply on Aug 15, 2006 7:42 AM by Renaun_Erickson

    View Stack Issue

      In my app, I have a viewstack. Each child to the view stack holds a custom component. Index 0 of the viewstack has a list of communitys. When you clik on one, it changes static properties on a class that I made. I did this so each canvas in the view stack could access these values. So you click on a community, then go to the next child the displays information based on the value of the static properties. I import that class in to the AS of that component, and set variables, which then set the text to text fields in the canvas. This all works great...but. If I go back to the first child and choose another community, the static property does indeed change, but when i go back to the next canvas, the one that displays info, it does not update. What I really need to know is how to re-execute the AS function in that component to reset those text fields(along with other method,etc). I did an "click" and it worked fine, but that is obviously undesireable. I try and place code where 'myViewStack' can be accessed, and do some sort of 'dot down' or 'dot up', but no luck. Any help would be great.
      Thanks a lot
        • 1. Re: View Stack Issue
          Renaun_Erickson Level 1
          You need to make the static properties Bindable, which you can't in Flex 2. Unless you create a pattern to do so, or just use parentApplication.

          Cairngorm has a Model pattern of producing Bindable model class instances through a Static class.

          Another approach is to take your AS class of your properties do not make them static but include the file in the main mxml file. Make all the properties Bindable and then you can access them by parentApplication.someProperty.
          • 2. Re: View Stack Issue
            upshotvideo Level 1
            Thank you for your reply, however, my problem is not with accessing and changing the values of the static properties. I'm able to change and receive the values from anywhere in the app, im just having trouble getting the canvas that dislays the info to update. I change the values with a click on a datagrid, which changes the values, then when the other canvas initilizes, it works fine. My problem is that when i change the values back in the first canvas AGAIN, the other canvas doesnt update b/c it had already been initialized, which triggers the appropriate functions to display the info. I did an alert on this page after changing the static props. a couple times, and it comes out perfect. I just dont know how to execute those functions again after they had already been initialized. I would like to do this maybe in the main app's script from the 'change' on the viewstack, but i cant seem to get to the canvas and change its properties throught that script. Or maybe some sort of 're-initialize'.. Does this make any sense?
            Thanks again for any help
            • 3. Re: View Stack Issue
              Renaun_Erickson Level 1
              Yes I understand, it looks like you need to take another approach.

              What controls are using the "initialized" variables? For example if it was a Label and the text attribute was bound to a property then when ever that property changed it would always show. Think in terms of binding not setting things through function.

              Can you make a really small example code snippet so we are on the same page?