As far as I know, Flex gods from Scotland do not advise the use of code behind approach as seen in .net. I was doing the same at the beginning but after having a chat with them I see why it's not good.
First of all there is no code generator that would create references to all mxml elements in the accompanying AS class. Second and more important, you can't use data binding that way which is one of the most powerful features of Flex. And there is also third, which is Cairngorm. Cairngorm is ment to use mxmls as classes, so you treat them as a class. There's more to Cairngorm than this of course but if you'd like to implement it don't use code behind approach. Alen --- In [email protected], "cubrip" <[EMAIL PROTECTED]> wrote: > > Hi, > > I just wanted to use code behind in a flex application, but wasn�t > sure which way to go. > > In all Examples/Mailinglists,... following method was used. > > MyClassCodeBehind extends e.g. Canvas > > in the MyClass.mxml the root node is type of MyClassCodeBehind. The > mxml class extends more or less the class MyClassCodeBehind. > In this case the class MyClassCodeBehind of course has no access to > the components in the mxml file. So all components have to be declared > in the class MyClassCodeBehind as public properties. From the mxml > file I can access Methods of class MyClassCodeBehind. > > If I make it the other way round, I can extend MyClass.mxml in class > MyClassCodeBehind and don�t have to declare all components as > properties because they are already derived from the parent > MyClass.mxml. Drawback of this method is that if I want to call a > method in the MyClass.mxml I have to implement a stub in MyClass.mxml > and overwrite it in MyClassCodeBehind. But I don�t want to make > function calls in mxml anyway. I want to have the code in the code behind. > > Have I missed something specific, why everyone is using the first > method and not the other option? > > cheers, > > Christoph >

