flash actionscript:
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.
tabPathOff_btn.onPress = function() {
var prog:Number = new Number;
var routeMap_mcl = new MovieClipLoader();
routeMap_str = "FLASH/ROUTES/" +
currentStartXMLNode.attributes.abreviation +
"-" + currentEndXMLNode.attributes.abreviation + ".swf";
routeMap_mcl.loadClip(routeMap_str, "_root");
routeLoadListener = new Object();
routeLoadListener.onLoadProgress = function(target_mc, loadedBytes,
totalBytes)
{
prog = Math.round(loadedBytes/totalBytes*100);
trace("Loaded " + prog + "%");
}
routeLoadListener.onLoadComplete = function(target_mc) {
trace("Map Loaded...");
}
routeLoadListener.onLoadError = function (target_mc, errorCode) {
trace("Map failed to load..." + errorCode);
showRoute();
}
routeMap_mcl.addListener(routeLoadListener);
}