Shaun_Max We cannot call non static functions within a static function?
Nope, unless you call an instance function from a passed instance object argument.
Static functions are to say, "Hey we cannot possibly alter your state, but we can operate ON things though!"
Static template scope has no state other than the static found on the static scope;
FooBar.myStaticVar = 42
<- This is not state, it's a single value tied to FooBar class template.
public class FooBar {
public static var myStaticVar :int = 0; // class template state (global to FooBar scope)
public var baz :int = 0; // instance state
public static function staticFunction(fooBar:FooBar):void {
fooBar.baz = 42; // changing baz through the instance
FooBar.myStaticVar = 41; // changing the same pointer every call
}
public function instanceMethod(fooBar:FooBar):void {
this.baz = 42; // changing 'this' instance
// or
fooBar.baz = 222; // is the same instance but public call on instance
FooBar.myStaticVar = 41; // same ole song and pointer
}
}
I don't know if this helps or not but, hey! 🤣