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



Reply via email to