5 Replies Latest reply on Nov 16, 2006 6:19 AM by Peshunder

    File Organization and External Loading of SWF

      Hi everybody,

      Basically i want to know 2 things:
      1. In what way to load external (additional data) into a main application
      Basically i want to have like a main app. then i load (is it through SWFLoader object?) a login screen. Then, when you login, i want to get rid of this screen (maybe should i say "component") and have something else come up from a separate file. Then i want to be loading the separate modules of my app upon request only, not embed - only runtime.
      How do i do all that?
      Which leads to the second question
      2. How to structure my project files and directories
      That is,
      Do i make different states? i will have like a hundred states...my mxml file will be miles long with this addchild, removechild...
      Do i make one application file that is set up as "default" and then make additional other mxml files? I tried that. what happens is that all the swf files and the debug files of the additional modules are going straight in the bin directory. i don't want that. i will have a lot of modules and i want them to be organized. On top of that they all share the same history management i think and i have to deal with that too somehow...
      Do i make separata projects for each module? that's a lot of hussle, i feel its pointless and there must be a better way...

      so...i am lost, can i have some help, i think this is very universal problem. One little tutorial could solve all my problems. or a book that has a lesson that goes through it. Unfortunately, guess what, 1 book comes out in december and the other one in february...

      HELP please
        • 1. Re: File Organization and External Loading of SWF
          peterent Level 2
          Take a look at Roger Gonzalez's blog: http://blogs.adobe.com/rgonzalez/ and read the entries on Modular Applications - which is what you are describing.
          • 2. File Organization and External Loading of SWF
            Peshunder Level 1
            its a little too complex for me. I can't even tell if this is what i need.
            how about the Explorer Sample application that comes with flex. this is exactly what i want, given that all the apps are made in separate files
            (Help->Flex Start Page and then under Flex Samples is the Flex Style Explorer )
            Isn't this the solution i need? If i dig into the files of the installation folder, i can see that there are different '.mxml' files for the different modules. Except, i can't figure out how they are connected and loaded and what the structure is of the project folder that whoever built it had...
            • 3. Re: File Organization and External Loading of SWF

              I have the same questions.

              Any ideas here?

              • 4. Re: File Organization and External Loading of SWF
                peterent Level 2
                It is a little complex because the security model the Flash Player uses and because of the application domains. Basically, the domains allow you to decide how your applications are loaded. One method allows for complete sharing of data, resources, and function calls. Another method isolates them. You probably want the former.

                How you organize your application structure is up to you. Some people develop and test the applications which are to be used as modules as separate projects. Then they have a master project which has the main application that loads them as needed. This project also includes the runtime shared library. Other people develop the RSL separately. Other folks just make one large project. It is really up to you.

                If you are going to use multiple SWFs to make an application, seriously consider using RSLs - they will save the end user a ton of time downloading the SWFs because the SWFs that use the RSLs will be a fraction of the size they would be if they contained all the same code.

                Read up on RSLs, SWFLoader, and LoaderContext. I'm making a note to provide a simple example on my blog that shows how to load one app into another and communicate between them.
                • 5. Re: File Organization and External Loading of SWF
                  Peshunder Level 1
                  Hi Peter,

                  I have been reading Roger Gonzalez's blog and he notes that developers (i dont know if you are) are releasing a library "mx.modules" in Flex 2.0.1.

                  Is that our dreamed solution?