1 person found this helpful
But when I called Infused.loginResult(evt) I get the error: Access of possibly undefined method loginResult through a reference with static type Class.
You can't call instance methods like that. You'd need to make the method static, or alternately, call Infused(Application.application).loginResult(evt). After you make either change, you should be able to use the ['functionName']() approach.
Keep in mind, though, that you're coupling your DataManager to your application with this approach. This might be fine for a small app, but take a look at Mate (or some of the other MVC frameworks) to see how to reduce or avoid this sort of coupling.
The initial app was built around a thought process as I am just learning AS3 in Flex, and is quite small. I will make sure to MVC the final app once I have a better understanding of the approaches to this in AS3.
However, what you suggested doesn't seem to work. If I make the method static, then I cannot reference the MXML components. If I tru to call Infused(Application.application).loginResult() I get a "Access of undefined property Application" error.
If your handlers are referencing components within the app, you're right--static is not an option. The other approach should work, though. Perhaps you need to import mx.core.Application?
Ah finally, I can separate my data logic!
Thanks man, I had imported mx.core.Application
<< a contented developer!