Hi Tom, You've hit on one of the classic "anti-patterns" of Flex programming: Application.application.blah type stuff.
While this is regrettably somewhat 'normal', that doesn't mean it's ok :) As you probably have guessed, it leads to code that is really hard to change later on as it is all tangled up with itself. The solution is to use one of the application patterns that have been studied by the GUI programming community in general (not just Flex programmers) ... such as MVC (Model-View-Controller). Martin Fowler is one of the canonical sources on this stuff: http://martinfowler.com/eaaDev/uiArchs.html Mate, Parsley or Cairngorm are open-source Flex frameworks that implement the shell of one or more GUI patterns to save us all re-inventing the wheel. Realistically, most people learn the patterns by using one of these frameworks or their cousins (there are more, I'm just giving a few that are currently flavour of the month). Cairngorm has been getting a bad rap lately due to testability of the resulting application (or lack thereof), but it's deeply embedded in the Flash community (for better or worse). Martin Fowler et al will give you an academic understanding, introduce you to some code (Martin Fowler uses C# WinForms), explain the finer points and describe several variations that you may or may not find interesting. You've bitten off quite a large topic with that innocuous question ;-) Jules On Tue, Dec 2, 2008 at 23:56, tom s <[EMAIL PROTECTED]> wrote: > Hi, > > I'm writing my first flex app. > So far it all works, but I'm getting to the point where I need to start > structuring it, for ease of further development. > Right now I simply have many functions defined within the <script> tag > within the <application>. > I'm now thinking through my options for structuring this better. I'm not > asking for *specific* structuring recomendations, as I know that would be > imposisble w/o you knowing the specifics of what I'm doing. > > What I'm looking for is a good place to read about the different options, so > I can learn about them. > Preferable free online, or in Safari Books Online. > > To be clear: when I say structural options I mean things like: > a) having all the code in the <script> > b) putting the code in a seperate .as and point <script source=""> at it (I > know this is very similar to (a) ) > c) using static methods in a 'static' class > d) creating classes to fully OOize the code > e) something else I dont yet know about... > > I'm reading 'Advanced Action Script 3 with Design Patterns', which I hope > will help, but I would like to have some flex specific knowledge also, so > that I can see examples of how to allow objects outside the <application> to > access those defined by mxml within the application (like buttons). I'm > concerned that will end up with a lot of Application.application.foo type > code - is that 'normal'? > > I'm hoping this makes enough sense... > > thanks > > tom > >