In my recent efforts to clean-up some prototype code, I have introduced an error that I can't seem to figure my way around...
In my main Flex application, I refer to other MXML objects via <local:MyMXMLObject id="myObj"...>
The "MyMXMLObject.mxml" was created to keep the code cleaner, and consisted of other basic <mx:...> components.
I also had a huge <mx:Script CDATA...> block in my application code, which had functions that manipulated behaviors in the MyMXMLObject (myObj).
This all worked wonderfully, until I decided to do some further cleanup, and create some ActionScript files, which I would include in the beginning of my application using <mx:script source="myInclude.as">. So now, my ActionScript files have functions that have references to components that used to be in the same scope, when resided in the application object. I even had "this." refrerences in the function code, which I've recently removed.
I'm getting errors when the functions get called: "TypeError: Error #1009: Cannot access a property or method of a null object reference.". I completely understand why I'm getting the errors, I just don't understand enough about application, component, and variable scope to figure out how to resolve this. I tried importing mx.core.Application.application, to see if I could access application.myComponent, but that didn't seem to work. Probably because an application variable was never set to the parent application... I just don't understand enough about Flex yet to work through the particulars of how that all might work???
So my basic question is... How do I access a component of my main application (really properties or methods), from ActionScript files, which I've included in my application through <mx:script source...> includes?
Please let me know if I can provide any additional information of use.
Thanks and best regards,