user546595
user546595

Reputation: 1

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

How can same be false in the following snippet?

var child1:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
var child2:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);

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

Upvotes: 0

Views: 107

Answers (1)

shaunhusain
shaunhusain

Reputation: 19748

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.

Upvotes: 2

Related Questions