Hi, I trying to extends ObjectProxy class, the reason is because I want to have a Singleton of the ObjectProxy class, so I made something like
package utils
{
import mx.utils.ObjectProxy;
public class UniformObjectProxy extends ObjectProxy
{
private static var _instance:UniformObjectProxy;
public function UniformObjectProxy(secure:PrivateClass, item:Object=null, uid:String=null, proxyDepth:int=-1)
{
super(item, uid, proxyDepth);
}
public static function getInstance(item:Object=null):UniformObjectProxy{
if(UniformObjectProxy._instance == null){
var security:PrivateClass = new PrivateClass();
UniformObjectProxy._instance = new UniformObjectProxy(security, item);
}
return UniformObjectProxy._instance;
}
}
}
class PrivateClass{
public function PrivateClass(){
}
}
when I create my object uniform which is a simple object, I pass it to my UniformObjectProxy.getInstance() static method to get the instance of my objectProxy, ok so far so good
my problem is when I try to bind a property of my objectProxy instance like
_opc = UniformObjectProxy.getInstance(_uniform);
cw:ChangeWatcher = BindingUtils.bindSetter(dispatchColorChange, _opc, data.id);
the dispatchColorChange handler function is called only once an never again, I had check ChangeWatcher.isWatching() and return false meaning my objectProxy is not binding properly, if I create an objectProxy like
_opc = new ObjectProxy(_uniform);
cw:ChangeWatcher = BindingUtils.bindSetter(dispatchColorChange, _opc, data.id);
the binds works just fine, so my thinking is the problem is when I extends the objectProxy class, how is the proper way to do this, please help me!, thanks for any clue!!