Hi,
In a few of my scripts, I’ve come across an issue when using a single loader to load assets.
It seems that if the loaders content is re parented, subsequent calls to the loaders load() method will intermittently throw an argument error, listed below:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::Loader/_load()
at flash.display::Loader/load()
The stack trace is showing that the error is occurring internally in the Loader class, in its _load method. Looks me me like its trying to do something with its content prop, finding its not there and throwing this error.
Is this expected behaviour, or should the loader object be able to handle loading in mulitple objects, even if its loaded content is re parented? I thought that was the point of the Loader class.
To me, this seems like a bug in the Loader class. To me it should be able to handle having its content reparented, and check for the existence of this content when a new call to its load() method is made. Interestingly, this does not occur when using Flash Player 10, only with version 9 players. According to the docs, the Loader class should only throw IOErrors and Security Errors.
The easy work around is to create new Loader instances.