Need Flex Migration Help?
- Adobe ends Flash player support in 2020
- Flex apps will no longer function
- We can help migrate your app
I was working on a deferred instantiation issue with Kyle from Adobe Support and came across this chunk of code in Container.as.
if (child is Container)
Container(child).recursionFlag = recurse;
It seems innocuous. The child, which is some descendant of Container is cast as a Container and then the recursionFlag is set. So be it. The interesting part though is the definition for recursionFlag.
private var recursionFlag:Boolean = true;
You see, recursionFlag is a private variable. So, I should not be able to set it from outside of Container. In fact, if the container represented by the child variable was a VBox, HBox, etc., the child itself would not be able to set this variable as it will not have access to this non-inherited property.
However, Container (the base class) can set this private variable on instances of Container subclasses. Think of it like this: private variables in instances of a class are treated more like public variables when accessed by the base class that originally defined that variable… confused yet?
Perhaps this is also a feature of other OO languages and I just missed it along the way, but it through me a bit. I am still working on a better way to exploit this … stay posted.