Alt To OnLoadError
Is there an alternative to onLoadError, as I don't want to publish in player 7?
Or perhaps it would be better to explain what I am trying to accomplish.
My main movie is made up of smaller external swf's that are loaded as needed.
I would like to preLoad the smaller swf's as the main movie is playing. Easy enough. Except, I am trying to keep my main movie as dynamic as possible, so my thought is to have a looping preLoader that looks for a sequentially numbered swf. That way, I don't have to type the names of all the smaller swf's in by hand. When it no longer finds one, it has reached the end of the smaller swf's needed to preload.
Does this make sense? Does anyone see how this may cause problems? And finally, does anyone know of an alternative to onLoadError, which would basically tell my looping preloader to stop searching for smaller swf's to preload because it has reached the last one?
Thanks in advance.
_t
FlashKit > Flash Help > Flash ActionScript
Posted on: 05-11-2004, 04:58 PM
View Complete Forum Thread with Replies
Sponsored Links:
OnLoadError
Hi there
Im building an application that loads a list of other swfs into it. Im using a class to handle all the loading and to allow the user to switch between swfs. Ive created an empty movieclip on the stage for each swf to load into ( ib code ), each clip has seperate MovieClipLoaders and Listeners. I want to attach a fallback clip from the library if a swf doesnt load properly.
However im having trouble attaching the fallback movieclip, screenLoadingErrorMessage from within the onLoadError event.
Here's my code
class ContentLoader
{
private function createContentArrays()
{
//create a movie clip for every swf thats loaded
//create MovieClipLoader for every swf thats loaded
//create Listener for every swf thats loaded
// create an on load error event to attach error message
contentListeners.onLoadError = function(target_mc:MovieClip)
{
var screenLoadingErrorMessage:MovieClip = target_mc.attachMovie("screenLoadingErrorMessage","screenLoadingErrorMessage",100);
trace("target_mc: " + target_mc); // ok
trace("screenLoadingErrorMessage: " + screenLoadingErrorMessage); // undefined
}
}
Can anyone tell me where im going wrong?
Thanks
View Replies !
View Related
OnLoadError Help Please
In the response to an onLoadError during a sequence of loadClip(targetSWF, targetMC) calls I want to replace the targetMC with a default symbol from the library using attachMovie. Because I want the attached clip to replace targetMC I store its name and parent before deleting it. The code below seems simple enough but newTarget traces undefined, while the other traces are fine. I've checked the symbol id etc in a simple version of the attachMovie statement that doesn't use the mc from the onLoadError event and it works ok. Is there a reason why this can't be done?
Attach Code
mainLoaderLstnr.onLoadError = function(target_mc:MovieClip) {
loadDefault(target_mc);
};
function loadDefault(target) {
var targetName:String = target._name;
var targetParent:MovieClip = target._parent;
// delete target_mc which is to be replaced
target.removeMovieClip();
trace("loadDefault(): target: "+target+", targetParent: "+targetParent);
// attach defaultPane symbol
newTarget = targetParent.attachMovie("defaultPane_id",targetName,2);
trace("loadDefault(): newTarget: "+newTarget);
}
View Replies !
View Related
Trouble With OnLoadError
I'm using onLoadError, pretty much right from the Help example. I want to do nothing when a URL is not available. Instead I still get "Error opening URL ..." in the Output window. I am loading about 60 images from Web cameras. When one can't be loaded I want to ignore it. Here is the code.
Attach Code
var loadListener:Object = new Object();
loadListener.onLoadError = function(target_mc:MovieClip, errorCode:String, httpStatus:Number) {
//trace(">> loadListener.onLoadError()");
//trace(">> ==========================");
//trace(">> errorCode: " + errorCode);
//trace(">> httpStatus: " + httpStatus);
}
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
var mc5_4:MovieClip = this.createEmptyMovieClip("mc5_4", this.getNextHighestDepth());
mcLoader.loadClip("http://213.243.80.55:8383/", mc5_4);
View Replies !
View Related
OnLoadError Question
ok so i have this code:
ActionScript Code:
for (i=0; i<_root.pages; i++) { slideMC_mc.duplicateMovieClip("slide"+i, i, {_x:i*234}); this["slide"+i].loadMovie("pics/"+i+".jpg");}
basically i want to trace("error"); if one of the pictures in the /pics directory isnt there.
I know I have to attach a listener and do myListenere.onLoadError = function(); but i dont know how to attach a listener to the dynamically created movieclips.
View Replies !
View Related
Sound.onLoadError?
I'm loading external mp3 using the loadSound method of the sound object. But it seems there's no onLoadError method (like the MovieClipLoader class has), which would be useful. Is there any way to take action if an mp3 isn't found?
View Replies !
View Related
Movieclip Loader OnLoadError
hi i have movieclip preloader with onLoadError function :
function onLoadError(mc:MovieClip, errorCode:String, httpStatus:Number) {
error_display = "Error: " + errorCode + " httpStatus: " + httpStatus;
}
error_display is dynamic text variable to show the error.when i try to load a.swf i got these error msg
Error: LoadNeverCompleted httpStatus:200
did anybody know what httpstatus 200 mean ? and how to handle this error so the swf can completly loaded. is it the problem on my a.swf(the file that being loaded) ?
any response will be very appreciated,thanks before
View Replies !
View Related
OnLoadError For Checking File Exist?
Hi Everyone...
Just wondering if there is a easy way to dynamically check if a file exist, if not, then go do something. So far the only way I have found was to use the onLoadError of mclListener but not sure if this is the best way to tackle this.
Thanks
View Replies !
View Related
OnLoadError Issues With External Swfs
Hi everyone,
I've been bashing my head against a wall with this one for the past couple of weeks, and I think I'm starting to do some permanant damage.
What I have is this... I have a blank movieclip and on the first frame is the following:
this.attachMovie("adspace_mc1", "adspace1", 1);var adspace_mc1:MovieClipLoader = new MovieClipLoader();
var listenerObject:Object = new Object();
listenerObject.onLoadError = function() {trace("an error occurred.");};
Now, the 'adspace' movieclip which is loaded with attachMovie contains the following actionscript attached to its instance on the stage:
onClipEvent (enterFrame) {
if (counter == null) {
loadMovieNum("file1.swf", 1);
counter = 2;
} else if ((_level1._totalFrames != undefined) && (_level1._currentFrame == _level1._totalFrames)) {
filename = "file"+counter+".swf";
loadMovieNum(filename, 1);
counter++;
}
}As you can see, the movieclip loads a whole bunch of external swf files once by one, starting from file1.swf and going up (file2.swf, file3.swf, etc...). My problem is this. I'm trying to get the onLoadError command to tell me when we get to the end of the files that have to be uploaded, so I can set the counter back to 1. There's no way of me knowing how many file.swf files are going to be in the directory, so what I'm trying to do it to get Flash to start the counter again once there's an error (i.e. there are no more files to load).
Perhaps I'm going about this completely the wrong way, but it's driving me insane. I'd be really hapy if someone can help me out at all.
Thanks in advance,
Stu
View Replies !
View Related
MovieClipLoader Class, OnLoadError Event Handler
Hi everybody,
In some part of my code, i am using the MovieClipLoader Class.
In order to test it, i have use name of file that don't exist so i could test the onLoadError event handler.
The problem is that this event is called 2 time for each file and with the same errorCode and target mc.
Can someone tell me why this event is called 2 time. Only one time would be better since i am executing code when i get error.
Thanx,
SimonBoris.
View Replies !
View Related
|