3 Replies Latest reply on Aug 30, 2010 9:20 AM by skellerXYZ

    Code behind vs including as code with <fx:Script source="....."/>

    skellerXYZ

      I have been writing Flex code for over a year now and was introduced to the concept of code behind very early on and it made very good sense to me.   However one of the things I never liked about it is that you have to make everything public in the action script code behind class when most variables and functions should really be private.  For example you have a Label object in your MXML file and you want to set its value in the action script code behind.  You have to declare the labels variable in action script as a public when it really shouldbe a private variable.  No other code should be messing with the label.  Anyway I have started to take a hard look at “including” my action script code instead of inheriting from it by using the <fx:Script source=”…”/> MXML statement.

      What are peoples thoughts on this?  What are the advantages/disadvantage of each approach.

      Thanks,

      Spence