3 Replies Latest reply on May 6, 2011 9:15 AM by drkstr_1

    Classpath of "view" .fla's within a Flex project


      Hey all,


      In my most recent Flex / RobotLegs project, I've made an attempt to keep my view .fla files within the same folder hierarchy as my application (as opposed to a singular assets.fla or something to that effect). So far this has worked to great effect except there seems to be a difference in the way Flash Professional deals with classpath in a Document Class versus a Base Class. I can easily extend MovieClip components within the .fla's by setting the document's root classpath to the Flex application's default package ("../../../src") in the Actionscript Settings; and then naming their Base Class appropriately (view.components.modularview.AbstractModularView, for instance). I can also extend them easily as they show up in the default package when compiled to a .swc living in the /libs/ folder (ModularView extends ModularViewMC [where ModularViewMC is the export to AS name in the Properties of the MovieClip]). But when I try to declare a Document Class in the same manner, Flash throws a fit. It seems Flash Professional will only use a Document Class if it is set to the default package (package {}). This is fine and dandy (I mean, I can just have the Document Class .as file in the same folder as the .fla and, viola, sunshine and rainbows, right?) - but then, the final kick to the nether regions comes when ASDoc won't compile because the package of the Document Class doesn't align to the folder's package name. All in all, a nuisance, but something I'd love to get some feedback on. Below is an example of the folder structure.






                          AbstractModularView.as (implements interfaces and any potential dependency injection)

                          ModularView.fla (internal MovieClips can extend AbstractModularView, BUT it can't be used as a Document Class because of it's package name?)

                          ModularView.as (extends ModularView's swc assets with properties that should not need to be recompiled into the swc)


      If anyone has any insight into this conundrum, please reply or send me an email (pbradygeorgen@me.com).




        • 1. Re: Classpath of "view" .fla's within a Flex project
          drkstr_1 Level 4

          Erm... I use a package name in the document class all the time...


          What problem did you have with it specifically?

          • 2. Re: Classpath of "view" .fla's within a Flex project
            familiarcat Level 1

            Yeah - I've done it before and I don't know what the issue might be in this particular project. Basically, I have a preloader that was provided by an external resource that I moved into my project to live in src/view/components/preloader/Preloader.fla and it has an accompanying Preloader.as that lives in the same folder. In the Preloader.as, the package is set to default (package{}) and the Preloader.fla uses it as the Document class relatively (just Preloader in the Document class pane). Well, ASDoc doesn't like this very much, so I attempted to change it's classpath to reflect its proper place in my project (com.view.components.preloader). I set the fla's source path (in the Actionscript settings) to ../../../../src and expected the Document class name to recognize it as com.view.components.preloader.Preloader. No mas.


            I've messed around with different relative paths (thinking myself stupid and that I might have one too many ../'s in the source path) - basically, I'm wondering if Flash always expects the .fla file to live in the default package of the app as opposed to being nested within the apps's folder structure.



            • 3. Re: Classpath of "view" .fla's within a Flex project
              drkstr_1 Level 4

              I understand now.


              In the fla, you need to set your classpath to the top level src directory (I assume it's set to '.' right now). Then update the Preloader.as to use the full package. Use the full package in the Document class of the fla as well.


              That should sort you out.