Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error handling of missing files 1

Status
Not open for further replies.

spazool

MIS
May 9, 2000
14
ZA
How do I test and cover for a loadMovie that gives a missing file error?

I want to test for a missing file and then set the action to go to an error page.

Any ideas?
 
You could add a variable into the movie being loaded, in the first frame, ie:

loaded = "true";

Then, in the movie which initiates the load you could check for the existence of this variable in the level you state. For example, if I were doing this, I would have a button with the following actions inmy main movie:

on (release) {
loadMovieNum ("my-movie1.swf", 1);
tellTarget ("_root.variablecheck") {
gotoAndPlay (1);
}
}



This initiates the loading of "my-movie1.swf" into _level1, and at the same time initiates a 'control' movie-clip (instance name: "variablecheck", and residing in the main timeline), which would check for the existence of the variable in the loaded movie. I would have the control mc about say 24 frames long with the following actions in the first frame:


if (_level1:loaded=="true") {
stop ();
} else {
play ();
}


and the 'check' repeated in the last frame (for connection time puropses) with the instruction to goto the error frame if the variable is non-existent:


if (_level1:loaded=="true") {
stop ();
} else {
with (_root) {
gotoAndStop ("errorframe");
}
stop ();
}

...which tells the main-timeline to go to the frame labelled "errorframe" should the variable "loaded" in "my-movie1.swf" not be detected.
davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Thanks davdesign, I am going to give that a try. This is just what I was looking for! I'll let you know how it works out!
 
ok spazool, let me know if it doesn't also! ;-) davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Hi Dav,

I tried out the code you supplied, I was dead certain it was going to work, though I found that it always passed a "true" condition. I modified it slightly to work with targets rather than levels.

I realised that by not finding a MC there will be no _level1.loaded to check against & that the last _level1.loaded condition is held somewhere! It is very confounding... X-) I spent most of the day modifying the code with additional variables just to try and get something!

I could send you the FLA if you would like to play around with it!
 
send away, are you saying it still doesn't work?

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Hi again,

Here is a link to the site online that you could have a look at in the meantime, i have uploaded it in order to test in a live environment. The check problem as discussed above can be found in the "The Pictures" link...

 
Yup, it doesn't work, sorry I can be a bit vague in my explanations sometime..

I am busy looking at your website at the moment, fantastic work.. Shall I send the code to your email address?

Michael
 
I just realised I want to send it in a zip file are you mac or pc based? I can send either and HQX or ZIP
 
ok, why not change the action in the loaded movie to:

_level0:loaded = "true";


This way the variable can be searched for on _level0.

I'll rustle up a simple example while your link downloads.

dave
davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
zip please ;-) davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Hi Dave,

I am going to have to look through your code carefully! I will let you know how I do.

Thanks very much again for your help! :)
 
forgot to mention, change the variable in frame 1 of Movie2, or remove it from the folder, to test the error-checking mc.

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
gone out for a wee dram, will check back later.

I tested the loader 'live', it might be prudent to extend the second variable check in the loadcheck mc to account for connection to the loaded movie.

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Hi Dave,

Thanks for you help last night!

It works great, though I had to add a line to reset the _level0.loaded variable to false for use with multiple files, as the variable was remaining true.

I have modified a few things on the site and here it is in it's current form.


please let me know if there are any errors. Thanks (it is always good to have 3rd party check a site.

Michael
 
hi Michael,

nice work.

A few niggles though. When I clicked on the gallery pics I selected the underwater section and the gallery which appeared contained "the end" with no way of returning to the previous page and no images at all, is this under development at the minute? I would also stick a preloader in the 'equipment' section as it is 290K. Even on my remote 56K connection it takes a while and I (personally) like to know if something is loading or not, without having to check my connection in dial-up-networking.

Other than the above, everything works great, and expect an e-mail when I get back regarding b+w development! ;-)

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Hi Dave,

Well the problem that I was worried about is there.. It seems that the clip that I load doesn't seem to work? Only on some occasions... It is rather irritating, when I run it within flash testing the "connection speeds" it works out fine... I have gone through the code over and over again, and it all checks out! Also the underwater section in the gallery, uses the identical code as the two other sections... I am very confused !!

I had designed some really nice preloaders!! In fact I like them better than the rest of the flash stuff!!

michael
 
This is the wierdest setup I have ever done. The "camera.swf" which is the one being loaded in the equipment section, never redraws properly in the preloader? It is very odd. I have had a friend who works at IBM check it out and it works fine, and a friend in Vancouver Canada, also said it worked out fine, this is all very strange.

I just checked again, despite the bad redraws of the preloader, the actual swf file has loaded, if you exit that screen and reenter, it works fine...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top