Skip to main content
Participant
May 1, 2006
Answered

onLoadError won't run when MC doesn't exist

Can anyone help me?

I am using a movieClipLoader & listener object to dynamically load a SWF. If the SWF exists onLoadComplete and onLoadProgress work just fine (but only if they are not within an "if" statement, for some reason) but if the SWF does not exist onLoadError does not get called.

My MovieClipLoader is attached.

Like I said, everything works but the onLoadError function. Any idea why? I need to run my function "showRoute" if the map file does not exist. Is there a work-around?

Thanks for all your help!

~ Joseph Russavage ~

p.s. This is for an interactive acccessibility map I am building for my campus.
You can see this project in progress at www.humboldt.edu/~jmr74 and clicking on
the "Interactive Accessibility Map" link. The above command executes when the
user selects a starting and an ending location from the first two drop-down
menus, then clicks the "Info" button and then the "Route" tab. If there is no
route between the locations the user has selected the onLoadError function
needs to be called to provide other ways to get from A to B.
This topic is closed to new replies. Start a new post to keep the conversation going.
Joseph_RussavageCorrect answer
Participant
May 3, 2006
Thanks for the suggestions! I put the code within the onPress for teh same reason that one puts a for loop within an if statement... I don't need the code to waste memory or processor cycles unles one actually clicks on the button. But OOP is new to me, so some of the ground rules are too.

You are absolutely right about the order of the code in this case. I moved my "loadClip" statement after my listener objects and now it runs great.

Thanks for the lesson and the assistance!

~ Joseph ~

4 replies

Inspiring
May 2, 2006
For the onLoadError handler to work you have to provide a path to a file and in your case a path to a non-existing file.
Translate
Inspiring
May 1, 2006
Not sure. My guess would be that you should move the loadClip to after the listener code has been defined. Also it is kind of strange – from my perspective – to have all this defined inside the button onPress event handler. I would have it all outside of that and only have the loadClip in there.

Again and also odd, I have no idea why you would try and put events inside a conditional. What is that about?
Translate
Participating Frequently
May 1, 2006
quote:

Originally posted by: Rothrock
Not sure. My guess would be that you should move the loadClip to after the listener code has been defined. Also it is kind of strange – from my perspective – to have all this defined inside the button onPress event handler. I would have it all outside of that and only have the loadClip in there.

Again and also odd, I have no idea why you would try and put events inside a conditional. What is that about?



the good/bad thing about Flash scripting is that you can be sloppy coding and everything works fine. But as soon as you apply strict type programming, all hell break loose

But yeah, any sort of listener should be created outside under the main movie timeline frame on its own. Makes a lot more sense.

Other than that, have you tried create a simpler stand-alone flash file specifically only does this MCL? try that and see what happen
Translate
Joseph_RussavageAuthorCorrect answer
Participant
May 3, 2006
Thanks for the suggestions! I put the code within the onPress for teh same reason that one puts a for loop within an if statement... I don't need the code to waste memory or processor cycles unles one actually clicks on the button. But OOP is new to me, so some of the ground rules are too.

You are absolutely right about the order of the code in this case. I moved my "loadClip" statement after my listener objects and now it runs great.

Thanks for the lesson and the assistance!

~ Joseph ~
Translate