Hey Guys,
I’m hoping you can help me out with either a method or maybe I just need a better understanding to wrap my head around.
I’ve been building Flash programs with classes for years now but I’ve always only been able to talk “down” the heirarchy. If i wanted to talk “up” then I just referenced the root.
For example (OLD WAY AS2.0 days)
class Main_Program {
[INDENT]var myList:Array; [/INDENT]
[INDENT]var otherList:Second_Class;[/INDENT]
[INDENT]function Main_Program() {[/INDENT]
[INDENT][INDENT]otherlist = new Second_Class();[/INDENT]
[INDENT]myList = [global values that all classes should use];[/INDENT]
[/INDENT][INDENT]}[/INDENT]
[INDENT]function talkDown() {[INDENT]//talking "down" to the class to use it's functions.[/INDENT]
[INDENT]otherList.sendData();[/INDENT]
}
[/INDENT]}
And then for the Second_Class in order to talk “up” i’d do something like this.
class Second_Class {[INDENT]function talkUp() {[INDENT]//talking "up" to the Main_Program class by referencing the root.[/INDENT]
[INDENT]var usingGlobalValue = _root.mainProgram.myList[0];[/INDENT]
}
[/INDENT]}
So my question is this, in AS3.0 the only way i can “talk” up, is if i pass the value to the function which needless to say is very cumbersome and annoying.
What should I be doing to communicate between classes?
Thanks!