Since myClip doesn't exist shouldn't you just deal with the loader?

On Jan 26, 2008 4:57 AM, Leonardo Scattola - New Vision srl <
[EMAIL PROTECTED]> wrote:

> Hello everyone!
> I wrote a little class extending the AS3 Loader class.
> In my new loader I've added a reference to the clip to which attach my
> content, so that I can write
>
> myLoader.loadImage(url, clip:MovieClip)
>
> where loadImage is a static method; in an ideal world myLoader will
> always load an image, and will fire an Event.INIT when the image has
> been loaded; I have defined a listener for this event, like this:
>
> function onLoadSuccessful(myEvent:Event) {
>    trace(myEvent.target.loader.myClip);
> }
>
> where myEvent.target is the loaderInfo property in my event, and
> myEvent.target.loader is an instance of the myLoader object;
> myEvent.target.loader.myClip will thus be the reference to the clip on
> which I will attach my image.
>
>
> The problem is: when the image doesn't exist, I would listen for an
> IOError. In this case, I have defined another listener:
> function onLoadError(myEvent:IOEvent) {
>    trace(myEvent.target.loader.myClip);
> }
>
> But this raises an exception if the image fails to load (because the
> file doesn't exist), and tells me that the loader is not accessible
> because the event was fired "too early" to access the loaderInfo property.
>
> How can I access the myClip property in the onLoadError event?
>
> Thanks in advance.
>
> Leonardo
> _______________________________________________
> 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