4 Replies Latest reply on Aug 7, 2006 7:25 AM by Newsgroup_User

    Load XML before initialization

    Level 7
      I want to load one XML via HTTPService before any initialization (before
      any component begins render). That XML is used to pass some properties
      to the components begin initialized.

      Wich is the best method to do it?

      Thanks in advance.
        • 1. Re: Load XML before initialization
          Superflu
          use the initialize event on the application tag. Unlike the creationComplete event, the initialize fires before the app loads.
          • 2. Re: Load XML before initialization
            Level 7
            Felonius escribi�:
            > use the initialize event on the application tag. Unlike the creationComplete event, the initialize fires before the app loads.
            >
            Thanks going to try...

            • 3. Re: Load XML before initialization
              inlineblue Level 1
              I don't think the initialize event is going to work. Calling an HTTPService takes time, and by the time the result returns, your app would've rendered all your components. The only way this would work is if you created all the components dynamically (instead of in MXML), and you do the creation after the call returns.

              Another idea is to pass the data to your app using flashvars. That means your backend will have to retrieve the XML and then generate the HTML wrapper for your app to include the flashvars. Then in your app's initialize event you can retrieve the flashvars and set variables to use as properties for the visual components.
              • 4. Re: Load XML before initialization
                Level 7
                inlineblue escribi�:
                > I don't think the initialize event is going to work. Calling an HTTPService
                > takes time, and by the time the result returns, your app would've rendered all
                > your components. The only way this would work is if you created all the
                > components dynamically (instead of in MXML), and you do the creation after the
                > call returns.
                >
                > Another idea is to pass the data to your app using flashvars. That means your
                > backend will have to retrieve the XML and then generate the HTML wrapper for
                > your app to include the flashvars. Then in your app's initialize event you can
                > retrieve the flashvars and set variables to use as properties for the visual
                > components.
                >
                >

                Yes, the components will be created dinamically so the better way would
                be create them after the result event.

                Passing data to flashvars should works but we dont want to make public
                that data.

                Thanks for your help.