Looks like both classes are treated as different entities, most likely due
to application domain sandboxing. If that's the case, the definition of that
class in both the parent and child swf don't match and so you get an
coercion error.

Try passing a LoaderContext object with ApplicationDomain.current to the
Loader.
(From memory);

var context:LoaderContext = new
LoaderContext(false,ApplicationDomain.current);
loader.load(request,context);


Cheers
Juan Pablo Califano
2009/8/14 Joel Stransky <[email protected]>

> This I just don't get. I have a flash site where a particular .swf is
> present the entire time so I'm loading up it's library with the movieclips
> and bitmaps I'll need throughout the site. It's document class has a few
> simple public methods that return an instance of the symbol like this.
> //in libraryswf
> public function createMyBitmap():BitmapData{
>  return new MyBitmap(0,0);  //MyBitmap is the export/linking class name for
> a bitmap in the .fla's library.
> }
>
> I then created a singleton class to use as sort of an api so any class
> could
> create an instance of MyBitmap with MyAPI.instance.createMyBitmap() which
> looks like this
> public function createMyBitmap():MyBitmap{
>  return libraryswf.createMyBitmap();
> }
>
> This all worked fine for the first two symbols I created which were
> bitmaps.
> I extended BitmapData in order to add some custom properties.
> But when I went to add a movieclip to the flow, my api function started
> throwing this runtime error
>
> Error # 1034: Type Coercion failed: cannot convert
> com.domain.mypackage::mymoviec...@27133a67 to
> com.domain.mypackage.MyMovieClip.
>
> I tried typing it as a MovieClip at each part of the process which worked
> but of course I lose my custom props and methods.
> Any idea on how to deal with this properly? Thanks.
>
>
> --
> --Joel Stransky
> stranskydesign.com
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to