2 Replies Latest reply: May 24, 2012 2:35 PM by JDavi2001 RSS

    Global data in Flash Builder

    JDavi2001

      OK I admit I am a low level programmer but I need to build a set of data through several views in Flash Builder. I have gone down the singleton rabbit hole but would really appreciate a simple guide to persisting/updating data through an application.

        • 1. Re: Global data in Flash Builder
          mtdevuk

          Hi,

           

          That's a 'big' question. One way to do this is to use a public array variable such as:

               public var appParams:Array=new Array;

               appParams[0]=new Object;                                   //--- User details

               appParams[0]['username']=myUser;

               appParams[0]['displayname']=myUserFullname;    

               appParams[1]=new Array;                                    //--- Shopping cart (whatever!)

               appParams[1][0]=new Object;

               appParams[1][0]['productname']=myProductCode;

               appParams[1][1]=new Object;

               appParams[1][1]['productname']=myOtherProductCode;

           

          And so on.

           

          There are some very 'clever' ways to do what your ask, but using Arrays generally reduces the amount of code required in an app.

           

          m.

          • 2. Re: Global data in Flash Builder
            JDavi2001 Community Member

            Hi mtdevuk - I feel very rude since I have not revisited this post. I got this all working through singleton arrrays. The real deal was to get some understanding of the getInstance code - the persistance was the thing. Thanks for the update.