ActionScript: Using 'in' on protected/private variables?
- by David Wolever
Is there any way to mimic the in operator, but testing for the existence of protected or private fields?
For example, this:
<mx:Script><![CDATA[
public var pub:Boolean = true;
protected var prot:Boolean = true;
private var priv:Boolean = true;
]]></mx:Script>
<mx:creationComplete><![CDATA[
for each (var prop in ["pub", "prot", "priv", "bad"])
trace(prop + ":", prop in this);
]]></mx:creationComplete>
Will trace:
pub: true
prot: false
priv: false
bad: false
When I want to see:
pub: true
prot: true
priv: true
bad: false