3 Replies Latest reply on Oct 10, 2010 6:13 AM by FM_Flame

    What is the best way to separate functionality ?

    FM_Flame Level 1

      I have this project where I need to develop a component  for other flash developers to use. The scenario if you are the one who's going to use my "component" is like this:

      1) you create a new project

      2) you load the provided swf (or include the provided swc file) file and use the documented api (using interfaces if loaded as swf) to initiate it (for example just call the initiate function and that's it). What the component does itself is pretty much just adding a start up functionality to the website you are building, which includes: functions which make httpRequests and get data which the website will use, loading modules with fonts/graphic assets. It will also communicate the progress of these to the main application so the flex dev can display the progress to the user. At the end when the component has finished prepearing the assets you'll need for the website it notifies the main application.

      3) And there is where the flex dev start his work using the api provided with the component to access the data he needs.


      So what I want to do is package and keep my component source code compiled (to restrict access to the source code) and provide and easy way for the developers to use it. So I figured there 2 ways of doing that:

      1) compile a module/application swf

      2) complie a swc with a singleton


      I started doing it with module swf when I started wondering if that's the best way to do it. I would be happy if someone could give me any thoughts on this one, pros and cons maybe why should I do that and not the other, hopefully an adobe employee will take a look too. Thanks in advance!

        • 1. Re: What is the best way to separate functionality ?
          FM_Flame Level 1

          Actually, can I even compile swc files from flex using framework components like httpRequest and then load them as RSL ?




          Seems like I can make my custom component include it in a library project, export it as swc and include that swc as RSL in my actual Flex project.


          But I'm still not sure which approach is better, using RSL for this case or just a module? Does it make any difference ?



          Also another question that rises in my mind is that if using RSL which class should I extend from, when this component will have no visual representation but should be able to do httpRequests and load modules/applications?



          Message was edited by: FM_Flame

          • 2. Re: What is the best way to separate functionality ?
            Flex harUI Adobe Employee

            I didn't understand the question.  I would recommend packaging components as

            SWCs.  Otherwise, the user has to understand modules or sub-apps.

            1 person found this helpful
            • 3. Re: What is the best way to separate functionality ?
              FM_Flame Level 1

              Thanks, that kinda pointed me in building the component as swc since it basicly serves the same purpose as if it was a module but you can choose to merge it in code or load it as RSL. Also you don't have to write code to load it as if it was a module.

              In my case the structure of the website you build would kinda require the knowledge of modules and loading sub apps if you want to use all the system features so I guess I could have done it with module too, but seems like the swc approach is more convenient.


              P.S. I extended group.