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
you can just try to access it and catch resulting errors. 🙂
inis unaware of any namespaces currently opened (including private and protected in your case), and will only look within the public namespace.infor objects actually just callsObject::hasOwnProperty. Unfortunately, you effectively cannot override this method to alter its behaviour. the only class that can influence it isflash.utils::Proxy, which actually usesflash_proxy::hasPropertyto to determine the return value ofhasOwnproperty.So no, other than trying, there’s no other way sadly.