tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/3825-stageobserver-error-when-loading-sprite-from-new-swfRobotlegs: Discussion 2013-10-11T08:54:22Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/289232472013-09-21T12:56:15Z2013-09-21T12:56:15ZStageObserver error when loading Sprite from new SWF<div><p>Hi Matej,</p>
<p>I have no idea what's causing the error just from looking at
it.<br>
Somewhere in your code there must be an implicit or explicit type
conversion going wrong.</p>
<p>I don't think that overriding the constructor is a problem per
se. What kind of a class is the base class?</p>
<p>Are you by any chance loading third-party assets or embedding
some images with an incorrect type?</p>
<p>Taking a wild guess : in your code or in a third-party code,
something that is added to the stage has been cast to the wrong
data type.</p>
<p>Loading an asset like this:</p>
<pre>
<code>Embed(source='images/someImage.png')]
private var ImageClass:Class;
...
var myImage:Class = new ImageClass ();//<===bad
addChild(myImage as DisplayObject);</code>
</pre>
<p>will result in similar error as yours.</p>
<p>This would work:</p>
<pre>
<code>Embed(source=' images/someImage.png')]
private var ImageClass:Class;
private var image:Bitmap = new ImageClass() as Bitmap;// or as DisplayObject
addChild(image);</code>
</pre>
<p>Also, possibly not really related, but who knows, maybe it has
to do with the ApplicationDomain..<br>
See this:<br>
<a href=
"http://www.senocular.com/flash/tutorials/contentdomains/?page=2">http://www.senocular.com/flash/tutorials/contentdomains/?page=2</a><br>
Look for Same-definition Collisions</p>
<p>That's all I can help you with, sorry.</p>
<p>Ondina</p></div>Ondina D.F.