Page 1 of 1

avatar loading and ApplicationDomain

Posted: 18 May 2009, 14:10
by nig3d
Hi,

is it normal that I can't use any external resource holding a valid avatar that is loaded with an application domain different with the current one?
I'm forced to load the avatar library using this code:

Code: Select all

var loaderContext:LoaderContext = new LoaderContext();
				loaderContext.applicationDomain = ApplicationDomain.currentDomain;
				_loader.load(request, loaderContext);
All the other combinations generate an exception:
TypeError: Error #2007: Il valore del parametro child deve essere diverso da null.
at flash.display::DisplayObjectContainer/addChild()
at com.smartfoxserver.openspace.avatar::Avatar()
at com.smartfoxserver.openspace.avatar::AvatarsManager/createAvatar()

Now, what bother me is the massive memory leak I have on openspace project.
I can't find any way to let os release the data it allocates, not even using os.clear and all the other expedients I'm aware of.
Can you give me some hints?

Posted: 19 May 2009, 08:00
by Bax
It seems the instance of your custom AvatarMovieClip class that the AvatarsManager (mentioned in the error log) creates is null. When passed to the Avatarr class, the call addChild(null) causes the reported error.

Posted: 20 May 2009, 09:13
by nig3d
My application works on three level.

The first one is the main swf.
The second one holds all the subprojects swf that are loaded like dll.
the third one is the avatar code.

Each level has is own ApplicationDomain, but since now I use the standard loading, the children can see the applicationDomain of the parent project, but not viceversa.

To solve the problem I had to include the OpenSpace component in the main project, while it wasn't needed when the applicationDomain was shared.