Hey
If I have one Main class that initiates a second class like this:
Main.as
package {
public class Main extends Sprite {
function Main() {
var a = new SecondClass
}
public function coolStuff() {
trace("A");
}
}
}
SecondClass.as
package {
public class SecondClass extends Sprite {
function SecondClass() {
//do the coolStuff function in the Main class
}
}
}
How do I get my SecondClass to call the coolStuff function in the Main class? I tried doing somthing like “Main.coolStuff()” or “parent.coolStuff()” but it does not inherit and I can not be bothered with inheritance because I do not want to script my stuff like that. For example, I want a textFormat class to be defined on the Main class but used in all classes in my code, how do I do this? Im sorry to ask such a noob question but Im new to OOP and scripting ideas like this.
Thanks for your help,
Dan