views:

205

answers:

1

Does anyone know if it is possible to inject into a regular as3 (non mxml) class? I've tried with limited success. Thanks

+1  A: 

Could you be more specific? There's no difference between an "MXML" class and a class defined in ActionScript, it's just different ways of writing the same thing.

All that is needed for injection to work is a source property that is bindable and a destination property that is public (either a public setter or a public instance variable). If those two requirements are met and the code compiles it should work.

Look at the code for the example application you can find here: http://code.google.com/p/mate-examples/wiki/DocumentBasedExampleIntro and you will find a ton of injectors that target classes not defined using MXML (look for injectors targeting classes whose names end in "Model" especially). You can also find countless examples in the Mate forums.

Theo
Thanks Theo, I met all the above requirements but on instantiation of the object the setter was not being called. I will persevere with the knowledge that it can be done. However I thought that maybe the fact that mate is a flex specific framework could have been the reason I was having no joy. Cheers