Answered
Communication between Classes
I'm trying to wrap my head around this and need some help.
The scenario is this:
I have a main movie with it's Document class, the document class loads a few other classes
- Class 1 holds all of the file information, for example a few xml files and arrays
- Class 2 just a movie on the stage with a dataGrid
- Class 3 another movie on the stage with a button and text box
What looks so simple is hard for me to grasp, how do I get Class 2,3 to communicate with Class 1? So for example when button in class 3 is clicked it retrieves some text from Class 1 and displays it in the text box. Or lets say from the document class a method is called from Class 2 to retrieve info from Class 1 to display in the dataGrid.
Should I just include the Class 1 in every class that I need to use it? I would think that would weigh the file down but maybe flash only loads Class 1 into memory once and then if it is included again it just re-uses it.
Maybe a custom events class? Have no idea if that is the right track or even where to begin with that.
Or should I just write one giant Document class and forget the whole OOP idea.
Please help!
I have a main movie with it's Document class, the document class loads a few other classes
- Class 1 holds all of the file information, for example a few xml files and arrays
- Class 2 just a movie on the stage with a dataGrid
- Class 3 another movie on the stage with a button and text box
What looks so simple is hard for me to grasp, how do I get Class 2,3 to communicate with Class 1? So for example when button in class 3 is clicked it retrieves some text from Class 1 and displays it in the text box. Or lets say from the document class a method is called from Class 2 to retrieve info from Class 1 to display in the dataGrid.
Should I just include the Class 1 in every class that I need to use it? I would think that would weigh the file down but maybe flash only loads Class 1 into memory once and then if it is included again it just re-uses it.
Maybe a custom events class? Have no idea if that is the right track or even where to begin with that.
Or should I just write one giant Document class and forget the whole OOP idea.
Please help!