开发者

parentDomain of sibling ApplicationDomains not equal... how & why

How can same be false in the following snippet?

var child1:Application开发者_如何学运维Domain = new ApplicationDomain(ApplicationDomain.currentDomain);
var child2:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);

var same:Boolean = (child1.parentDomain === child2.parentDomain);
trace(same);


You're using the strict equality operator and you're creating two new objects, even though they share some property which is the currentDomain that is passed as an argument to the constructor they are not the same object, if you were to first create

var temp:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);

then assigned this as child1 and child2 then check their parentDomains against one another I would bet you'd get a different result. I would throw a breakpoint in there and look at the memory addresses of both the child1/child2 as well as child1.parentDomain and child2.parentDomain (in the debug panel) in order to determine what's really happening here, unfortunately the ApplicationDomain object is part of the closed source portion of Flash.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜