This content has been marked as final. Show 6 replies
I tried Loader.content after the clip is loaded:
Now I get this error:
1118: Implicit coercion of a value with static type flash.display:DisplayObject to a possibly unrelated type flash.display:Sprite.
However when I trace("ldrMovieCntr.content " + ldrMovieCntr.content); I get:
ldrMovieCntr.content [object MovieClip]
i doubt you're loading a sprite.
The class expects a Sprite, but I'm passing in a Loader with:
var ldrMovieCntr:Loader = new Loader();
var fcLoadedMovie:FadeClip = new FadeClip(); //CUSTOM CLASS
fcLoadedMovie.setClipToFade(ldrMovieCntr); //PASSING IN A TYPE Loader - CLASS
and with the revised code, a DisplayObject::
I changed the expected Param in the Class to be object as apposed to Sprite, but I was hoping for a better solution.
How can I load an swf via the Loader class and access it as a Sprite or subclass of Sprite?
Thanks for the response,
you can try casting it as a sprite, but it's really a movieclip so i can't see how that's going to work. does it only have 1 frame?
Currently it has one frame, but it will most likely contain many frames, I tried casting it like this Movieclip(ldrMovieCntr) and it doesn't work.
What are the consequences of using Object instead of being more specific and using Sprite in my class?
i have no idea what the consequences are because i know nothing about your class.
but it makes no sense to cast your loader as a movieclip. use the content property of your loader. and you wouldn't cast it using Movieclip(). use MovieClip(), if you needed to cast it. which isn't needed because it already is a movieclip.