StageObserver error when loading Sprite from new SWF

matej's Avatar

matej

20 Sep, 2013 09:11 AM

[Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert MC{com.lalala.me::ClassName@73af301 com.lalala.me::ClassName/constructor()}@10d1edc1 to Class.

I get this error when I try to add my loaded swf as a child.

error is in Line 103 in StageObserver
const type:Class = view['constructor'];

here it gets that error.

does it matter that my constructor method is overriden in my mail class of the SWF?
SWF root is Sprite, and not a MC

  1. Support Staff 1 Posted by Ondina D.F. on 21 Sep, 2013 12:56 PM

    Ondina D.F.'s Avatar

    Hi Matej,

    I have no idea what's causing the error just from looking at it.
    Somewhere in your code there must be an implicit or explicit type conversion going wrong.

    I don't think that overriding the constructor is a problem per se. What kind of a class is the base class?

    Are you by any chance loading third-party assets or embedding some images with an incorrect type?

    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.

    Loading an asset like this:

    Embed(source='images/someImage.png')] 
    private var ImageClass:Class;
    ...
    
    var myImage:Class = new ImageClass ();//<===bad
    
    addChild(myImage as DisplayObject);
    

    will result in similar error as yours.

    This would work:

    Embed(source=' images/someImage.png')] 
    private var ImageClass:Class;
    private var image:Bitmap = new ImageClass() as Bitmap;// or as DisplayObject
    
    addChild(image);
    

    Also, possibly not really related, but who knows, maybe it has to do with the ApplicationDomain..
    See this:
    http://www.senocular.com/flash/tutorials/contentdomains/?page=2
    Look for Same-definition Collisions

    That's all I can help you with, sorry.

    Ondina

  2. Ondina D.F. closed this discussion on 11 Oct, 2013 08:54 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac